tailwind #9
@ -12,12 +12,13 @@ TAKER_FEE = 0.2
|
||||
MAKER_FEE = 0.1
|
||||
|
||||
|
||||
def __add_to_dict_list__(dict: Dict[int, List], k, v):
|
||||
if k not in dict:
|
||||
dict[k] = [v]
|
||||
return
|
||||
def __add_to_dict_list__(dictionary: Dict[int, List], k, v) -> Dict[int, List]:
|
||||
if k not in dictionary:
|
||||
dictionary[k] = [v]
|
||||
else:
|
||||
dictionary[k].append(v)
|
||||
|
||||
dict[k].append(v)
|
||||
return dictionary
|
||||
|
||||
|
||||
class EventKind(Enum):
|
||||
@ -133,17 +134,16 @@ class SymbolStatus:
|
||||
def add_order(self, order: Order):
|
||||
if self.strategy:
|
||||
self.strategy.order_on_new_tick(order, self)
|
||||
__add_to_dict_list__(self.orders, self.current_tick, order)
|
||||
self.orders = __add_to_dict_list__(self.orders, self.current_tick, order)
|
||||
|
||||
# Applies strategy and adds position to list
|
||||
async def add_position(self, position: Position):
|
||||
# if a strategy is defined then the strategy takes care of creating a PW for us
|
||||
|
||||
if not self.strategy:
|
||||
pw = PositionWrapper(position)
|
||||
else:
|
||||
pw = await self.__apply_strategy_to_position__(position)
|
||||
__add_to_dict_list__(self.positions, self.current_tick, pw)
|
||||
self.positions = __add_to_dict_list__(self.positions, self.current_tick, pw)
|
||||
|
||||
def all_prices(self) -> List[float]:
|
||||
return list(map(lambda x: self.prices[x], range(1, self.current_tick + 1)))
|
||||
|
Loading…
Reference in New Issue
Block a user