36 lines
661 B
Python
36 lines
661 B
Python
from aq import models
|
|
|
|
class Transaction():
|
|
# def __init__(self, **kwargs):
|
|
# self.__dict__ = **kwargs
|
|
|
|
pass
|
|
|
|
class DynamicOrder():
|
|
def __init__(self, o):
|
|
self.__dict__ = o.__dict__
|
|
|
|
|
|
pass
|
|
|
|
class SystemState():
|
|
|
|
|
|
def __init__(self):
|
|
self.currentOrders = [];
|
|
self.transactions = [];
|
|
for o in models.Order.objects.all():
|
|
do = DynamicOrder(o)
|
|
self.processOrder(do)
|
|
# self.currentOrders.append(do)
|
|
|
|
def processOrder(self, o):
|
|
for co in self.currentOrders:
|
|
if co.pair_id != o.pair_id:
|
|
continue
|
|
if o.ordertype == 'S':
|
|
if co.ordertype == 'B':
|
|
if co.quantity > o.quantity:
|
|
|
|
pass
|
|
self.currentOrders.append(o) |