|
@@ -1040,6 +1040,28 @@ def new_news(message):
|
|
''', (message,))
|
|
''', (message,))
|
|
|
|
|
|
|
|
|
|
|
|
+def abs_spread(ownable_id):
|
|
|
|
+ connect()
|
|
|
|
+
|
|
|
|
+ cursor.execute('''
|
|
|
|
+ SELECT
|
|
|
|
+ (SELECT MAX("limit")
|
|
|
|
+ FROM orders, ownership
|
|
|
|
+ WHERE ownership.rowid = orders.ownership_id
|
|
|
|
+ AND ownership.ownable_id = ?
|
|
|
|
+ AND buy
|
|
|
|
+ AND NOT stop_loss) AS bid,
|
|
|
|
+ (SELECT MIN("limit")
|
|
|
|
+ FROM orders, ownership
|
|
|
|
+ WHERE ownership.rowid = orders.ownership_id
|
|
|
|
+ AND ownership.ownable_id = ?
|
|
|
|
+ AND NOT buy
|
|
|
|
+ AND NOT stop_loss) AS ask
|
|
|
|
+ ''', (ownable_id, ownable_id,))
|
|
|
|
+
|
|
|
|
+ return cursor.fetchone()
|
|
|
|
+
|
|
|
|
+
|
|
def ownables():
|
|
def ownables():
|
|
connect()
|
|
connect()
|
|
|
|
|