當前位置: 首頁>>代碼示例>>Python>>正文


Python bintrees.FastRBTree方法代碼示例

本文整理匯總了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 
開發者ID:ucaiado,項目名稱:rl_trading,代碼行數:24,代碼來源:book.py

示例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': []} 
開發者ID:ucaiado,項目名稱:rl_trading,代碼行數:35,代碼來源:core.py

示例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': []} 
開發者ID:ucaiado,項目名稱:rl_trading,代碼行數:28,代碼來源:core.py

示例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() 
開發者ID:ucaiado,項目名稱:rl_trading,代碼行數:9,代碼來源:book_cleaner.py

示例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 
開發者ID:abcabhishek,項目名稱:PyLimitOrderBook,代碼行數:9,代碼來源:tree.py

示例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 = {} 
開發者ID:PierreRochard,項目名稱:coinbase-exchange-order-book,代碼行數:7,代碼來源:tree.py


注:本文中的bintrees.FastRBTree方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。