def setUp(self): self.quedex_private_key = pgpy.PGPKey() self.quedex_private_key.parse(open('keys/quedex-private-key.asc', 'r').read()) self.trader_public_key = pgpy.PGPKey() self.trader_public_key.parse(open('keys/trader-public-key.asc', 'r').read()) trader = Trader('123456789', open('keys/trader-private-key.asc', 'r').read()) trader.decrypt_private_key('aaa') exchange = Exchange(open('keys/quedex-public-key.asc', 'r').read(), 'wss://url') self.listener = TestListener() self.user_stream = UserStream(exchange, trader) self.user_stream.add_listener(self.listener) self.sent_message = None def set_sent_message(message): self.sent_message = message self.user_stream.send_message = set_sent_message
MarketStreamClientFactory, Trader, UserStream, UserStreamListener, UserStreamClientFactory, ) from twisted.internet import reactor, ssl from autobahn.twisted.websocket import connectWS from time import time quedex_public_key = open("keys/quedex-public-key.asc", "r").read() exchange = Exchange(quedex_public_key, 'ws://localhost:8080') trader_private_key = open("keys/trader-private-key.asc", "r").read() trader = Trader(trader_private_key, '83745263748') trader.decrypt_private_key('s3cret') user_stream = UserStream(exchange, trader) market_stream = MarketStream(exchange) selected_futures_id = None sell_threshold = 0.001 order_id = 0 def get_order_id(): global order_id order_id += 1 return order_id class SimpleMarketListener(MarketStreamListener):
MarketStream, MarketStreamListener, MarketStreamClientFactory, Trader, UserStream, UserStreamListener, UserStreamClientFactory, ) from twisted.internet import reactor, ssl from autobahn.twisted.websocket import connectWS quedex_public_key = open("keys/quedex-public-key.asc", "r").read() exchange = Exchange(quedex_public_key, 'wss://api.quedex.net') trader_private_key = open("keys/trader-private-key.asc", "r").read() trader = Trader('83745263748', trader_private_key) user_stream = UserStream(exchange, trader) market_stream = MarketStream(exchange) selected_futures_id = None sell_threshold = 0.001 order_id = 0 def get_order_id(): global order_id order_id += 1 return order_id class SimpleMarketListener(MarketStreamListener): def on_instrument_data(self, instrument_data):
MarketStream, MarketStreamListener, MarketStreamClientFactory, Trader, UserStream, UserStreamListener, UserStreamClientFactory, ) from twisted.internet import reactor, ssl from autobahn.twisted.websocket import connectWS quedex_public_key = open("keys/quedex-public-key.asc", "r").read() exchange = Exchange(quedex_public_key, 'wss://api.quedex.net') trader_private_key = open("keys/trader-private-key.asc", "r").read() trader = Trader('83745263748', trader_private_key) trader.decrypt_private_key('aaa') user_stream = UserStream(exchange, trader) market_stream = MarketStream(exchange) selected_futures_id = None sell_threshold = 10000 order_id = 0 def get_order_id(): global order_id order_id += 1 return order_id class SimpleMarketListener(MarketStreamListener): def on_instrument_data(self, instrument_data): global selected_futures_id