本文整理匯總了Python中bintrees.FastRBTree方法的典型用法代碼示例。如果您正苦於以下問題:Python bintrees.FastRBTree方法的具體用法?Python bintrees.FastRBTree怎麽用?Python bintrees.FastRBTree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bintrees
的用法示例。
在下文中一共展示了bintrees.FastRBTree方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import bintrees [as 別名]
# 或者: from bintrees import FastRBTree [as 別名]
def __init__(self, s_side, fr_data, i_member=None):
'''
Initialize a BookSide object. Save all parameters as attributes
:param s_side: string. BID or ASK
:param fr_data: ZipExtFile object. data to read
:param i_member*: integer. Member number to be used as a filter
'''
if s_side not in ['BID', 'ASK']:
raise InvalidTypeException('side should be BID or ASK')
self.i_member = i_member
self.s_side = s_side
self.price_tree = FastRBTree()
self._i_idx = 0
self.fr_data = fr_data
self.parser = parser_data.LineParser(s_side)
self.d_order_map = {}
self.last_price = 0.
# control other statistics
self.best_queue = (None, None)
self.i_qty_rel = 0
self.i_cum_rel = 0
示例2: __init__
# 需要導入模塊: import bintrees [as 別名]
# 或者: from bintrees import FastRBTree [as 別名]
def __init__(self, env, i_id):
'''
Initiate an Agent object. Save all parameters as attributes
:param env: Environment Object. The Environment where the agent acts
:param i_id: integer. Agent id
'''
self.env = env
self.i_id = i_id
self.state = None
self.done = False
self.b_print_always = False
self.position = {}
self.ofi_acc = {}
self.d_order_tree = {}
self.d_order_map = {}
self.d_trades = {}
self.d_initial_pos = {}
self.log_info = {'duration': 0., 'total_reward': 0.}
self.learning = False # Whether the agent is expected to learn
for s_instr in self.env.l_instrument:
self.position[s_instr] = {'qAsk': 0.,
'Ask': 0.,
'qBid': 0.,
'Bid': 0.}
self.ofi_acc[s_instr] = {'qAsk': 0.,
'Ask': 0.,
'qBid': 0.,
'Bid': 0.}
self.d_order_tree[s_instr] = {'BID': FastRBTree(),
'ASK': FastRBTree()}
self.d_order_map[s_instr] = {}
self.d_trades[s_instr] = {'BID': [], 'ASK': []}
示例3: reset
# 需要導入模塊: import bintrees [as 別名]
# 或者: from bintrees import FastRBTree [as 別名]
def reset(self, testing=False):
'''
Reset the state and the agent's memory about its positions
:param testing: boolean. If should freeze policy
'''
self.state = None
self.done = False
self.position = {}
self.d_order_tree = {}
self.d_order_map = {}
self.d_trades = {}
self.log_info = {'duration': 0., 'total_reward': 0.}
for s_instr in self.env.l_instrument:
self.position[s_instr] = {'qAsk': 0.,
'Ask': 0.,
'qBid': 0.,
'Bid': 0.}
self.ofi_acc[s_instr] = {'qAsk': 0.,
'Ask': 0.,
'qBid': 0.,
'Bid': 0.}
self.d_order_tree[s_instr] = {'BID': FastRBTree(),
'ASK': FastRBTree()}
self.d_order_map[s_instr] = {}
self.d_trades[s_instr] = {'BID': [], 'ASK': []}
示例4: __init__
# 需要導入模塊: import bintrees [as 別名]
# 或者: from bintrees import FastRBTree [as 別名]
def __init__(self, f_price):
'''
A representation of a PriceLevel object
'''
self.f_price = f_price
self.i_qty = 0
self.order_tree = FastRBTree()
示例5: __init__
# 需要導入模塊: import bintrees [as 別名]
# 或者: from bintrees import FastRBTree [as 別名]
def __init__(self):
self.price_tree = FastRBTree()
self.volume = 0
self.price_map = {} # Map from price -> order_list object
self.order_map = {} # Order ID to Order object
self.min_price = None
self.max_price = None
示例6: __init__
# 需要導入模塊: import bintrees [as 別名]
# 或者: from bintrees import FastRBTree [as 別名]
def __init__(self):
self.price_tree = FastRBTree()
self.price_map = {}
self.order_map = {}
self.received_orders = {}