def parseDataSourceCloseSourceGraph(self, message): """ Парсит ответ на закрытие источника """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = Close_pb2.Result() messageResult.ParseFromString(response.result) return messageResult.result
def parseDataSourceSizeTrade(self, message): response = RPC_pb2.Response() response.ParseFromString(message) if not response.is_error: messageResult = Size_pb2.Result() messageResult.ParseFromString(response.result) print "Size ", messageResult.value
def parseDataSourceSizeGraph(self, message): """ Парсит количество отданных свечей """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = Size_pb2.Result() messageResult.ParseFromString(response.result) return messageResult.value
def parseEmptyCallbackTrade(self, message): """ Парсит ответ на пустой колбек """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = SetEmptyCallback_pb2.Result() messageResult.ParseFromString(response.result) return messageResult.result
def parseRPCCreateWindow(message): response = RPC_pb2.Response() response.ParseFromString(message) messageResult = CreateWindow_pb2.Result() messageResult.ParseFromString(response.result) print "Response on create window", messageResult return messageResult
def parseDataSourceHeightGraph(self, message): """ Парсит высоту свечи """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = H_pb2.Result() messageResult.ParseFromString(response.result) return messageResult.value
def parseRPCAllocTable(message): response = RPC_pb2.Response() response.ParseFromString(message) messageResult = AllocTable_pb2.Result() messageResult.ParseFromString(response.result) print "Response allow table", messageResult return messageResult.t_id
def parseDataSourceVolumeGraph(self, message): """ Парсит объем свечи """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = V_pb2.Result() messageResult.ParseFromString(response.result) return messageResult.value
def parseDataSourceTimeGraph(self, message): """ Запрашивает время свечи в потоке и от индекса свечи """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = T_pb2.Result() messageResult.ParseFromString(response.result) return messageResult
def parseDataSourceCloseGraph(self, message): """ Запрашивает закрытие свечи в потоке и от индекса свечи """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = C_pb2.Result() messageResult.ParseFromString(response.result) return messageResult.value
def parseTransaction(message): """ Парсит ответ по транзакции """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = sendTransaction_pb2.Result() messageResult.ParseFromString(response.result) print 'messageResult ', messageResult.result
def fetchDataSourceSizeTrade(self, uuid): message = Size_pb2.Request() message.datasource_uuid = uuid request = RPC_pb2.Request() request.type = RPC_pb2.DS_SIZE request.args = message.SerializeToString() return request.SerializeToString()
def parseDataSourceTrade(self, message): """ Парси запрос на открытие источника тиковых котировок """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = CreateDataSource_pb2.Result() messageResult.ParseFromString(response.result) print 'isOpen ', messageResult.datasource_uuid return messageResult.datasource_uuid
def parseRPCSubscribeLevelII(message): response = RPC_pb2.Response() response.ParseFromString(message) messageResult = Subscribe_Level_II_Quotes_pb2.Result() messageResult.ParseFromString(response.result) # print "Response ", messageResult print 'Bids', messageResult.bids print 'Offers', messageResult.offers
def parseDataSourceGraph(self, message): """ Парсит создание источника данных для свечек, вытаскивает uuid в терминале для этого источника """ response = RPC_pb2.Response() response.ParseFromString(message) messageResult = CreateDataSource_pb2.Result() messageResult.ParseFromString(response.result) print "Response ", messageResult return messageResult.datasource_uuid
def buildRPCCreateWindow(id): message = CreateWindow_pb2.Request() message.t_id = id request = RPC_pb2.Request() request.type = RPC_pb2.CREATE_WINDOW request.args = message.SerializeToString() return request.SerializeToString()
def buildRPCSubscribeLevelII(): message = Subscribe_Level_II_Quotes_pb2.Request() message.class_code = 'QJSIM' message.sec_code = 'SBER' request = RPC_pb2.Request() request.type = RPC_pb2.SUBSCRIBE_LEVEL_II_QUOTES request.args = message.SerializeToString() return request.SerializeToString()
def fetchItem(): message = getItem_pb2.Request() message.table_name = 'orders' message.index = 1 request = RPC_pb2.Request() request.type = RPC_pb2.GET_ITEM request.args = message.SerializeToString() return request.SerializeToString()
def setEmptyCallbackTrade(self, uuid): """ Ставит пустой колбек """ message = SetEmptyCallback_pb2.Request() message.datasource_uuid = uuid request = RPC_pb2.Request() request.type = RPC_pb2.DS_SET_EMPTY_CALLBACK request.args = message.SerializeToString() return request.SerializeToString()
def fetchQuoteLevelIIConnector(self): message = getQuoteLevel2_pb2.Request() message.class_code = 'QJSIM' message.sec_code = 'SBER' request = RPC_pb2.Request() request.type = RPC_pb2.GET_QUOTE_LEVEL2 request.args = message.SerializeToString() return request.SerializeToString()
def fetchDataSourceSizeGraph(self, uuid): """ Запрашивает по uuid источника количество отданных с сервера свечей """ message = Size_pb2.Request() message.datasource_uuid = uuid request = RPC_pb2.Request() request.type = RPC_pb2.DS_SIZE request.args = message.SerializeToString() return request.SerializeToString()
def fetchDataSourceCloseSourceGraph(self, uuid): """ Отправляет запрос на закрытие источника """ message = Close_pb2.Request() message.datasource_uuid = uuid request = RPC_pb2.Request() request.type = RPC_pb2.DS_CLOSE request.args = message.SerializeToString() return request.SerializeToString()
def parseItem(message): """ Парсит ответ по данным """ response = RPC_pb2.Response() response.ParseFromString(message) # print 'res ', response messageResult = getItem_pb2.Result() messageResult.ParseFromString(response.result) # print 'messageResult ', messageResult.table_row for key in sorted(messageResult.table_row, reverse=True): print "%s: %s" % (key, messageResult.table_row[key])
def fetchDataSourceLowGraph(self, uuid, index): """ Запрашивает высоту свечи в потоке и от индекса свечи """ message = L_pb2.Request() message.datasource_uuid = uuid message.candle_index = index request = RPC_pb2.Request() request.type = RPC_pb2.DS_L request.args = message.SerializeToString() return request.SerializeToString()
def fetchDataSourceTrade(self): """ Отправляет запрос на открытие источника тиковых котировок """ message = CreateDataSource_pb2.Request() message.class_code = 'QJSIM' message.sec_code = 'SBER' message.interval = CreateDataSource_pb2.INTERVAL_TICK request = RPC_pb2.Request() request.type = RPC_pb2.CREATE_DATA_SOURCE request.args = message.SerializeToString() return request.SerializeToString()
def fetchDataSourceGraph(self): """ Запрашивает создание источника данных для свечек """ message = CreateDataSource_pb2.Request() message.class_code = 'QJSIM' message.sec_code = 'SBER' message.interval = CreateDataSource_pb2.INTERVAL_M1 request = RPC_pb2.Request() request.type = RPC_pb2.CREATE_DATA_SOURCE request.args = message.SerializeToString() print "Request ", request return request.SerializeToString()
def fetchTransaction(): """ Отправляет запрос на открытие источника тиковых котировок """ order = dict({ 'CLASSCODE': 'QJSIM', 'ACTION': 'KILL_ORDER', 'ACCOUNT': 'NL0011100043', 'OPERATION': 'S', 'SECCODE': 'SBER', 'PRICE': '210.76', 'QUANTITY': '1', 'TRANS_ID': '1', 'TYPE': 'L', 'ORDER_KEY': '4132996527' }) message = sendTransaction_pb2.Request(transaction=order) request = RPC_pb2.Request() request.type = RPC_pb2.SEND_TRANSACTION request.args = message.SerializeToString() return request.SerializeToString()
def buildRPCAllocTable(): request = RPC_pb2.Request() request.type = RPC_pb2.ALLOC_TABLE return request.SerializeToString()
def parseQuoteLevelIIConnector(self, message): response = RPC_pb2.Response() response.ParseFromString(message) messageResult = getQuoteLevel2_pb2.Result() messageResult.ParseFromString(response.result) return messageResult