[Mod] remove unecessary code

This commit is contained in:
vn.py 2019-06-11 22:59:10 +08:00
parent 719aa2ac49
commit ebf49abfcb
2 changed files with 63 additions and 67 deletions

View File

@ -1,20 +1,15 @@
# encoding: UTF-8
"""
币安交易接口
Gateway for Binance Crypto Exchange.
"""
import re
import urllib
import base64
import json
import zlib
import hashlib
import hmac
import time
from copy import copy
from datetime import datetime
from threading import Thread
from vnpy.event import Event
from vnpy.api.rest import RestClient, Request
@ -57,16 +52,15 @@ ORDERTYPE_VT2BINANCE = {
OrderType.MARKET: "MARKET",
OrderType.STOP: "STOP_LOSS",
}
ORDERTYPE_BINANCE2VT = {v: k for k, v in ORDERTYPE_VT2BINANCE.items()}
DIRECTION_VT2BINANCE = {
Direction.LONG: "BUY",
Direction.SHORT: "SELL"
}
DIRECTION_BINANCE2VT = {v: k for k, v in DIRECTION_VT2BINANCE.items()}
binance_symbols = set()
symbol_name_map = {}
@ -80,15 +74,15 @@ class BinanceGateway(BaseGateway):
"key": "",
"secret": "",
"session_number": 3,
"proxy_host": "127.0.0.1",
"proxy_port": 2000,
"proxy_host": "",
"proxy_port": 0,
}
exchanges = [Exchange.BINANCE]
def __init__(self, event_engine):
"""Constructor"""
super(BinanceGateway, self).__init__(event_engine, "BINANCE")
super().__init__(event_engine, "BINANCE")
self.order_manager = LocalOrderManager(self)
@ -151,6 +145,7 @@ class BinanceGateway(BaseGateway):
self.count = 0
self.event_engine.register(EVENT_TIMER, self.process_timer_event)
class BinanceRestApi(RestClient):
"""
BINANCE REST API
@ -731,7 +726,7 @@ class BinanceTradeWebsocketApi(BinanceWebsocketApiBase):
# Push order event
order.traded += traded_volume
order.status = STATUS_BINANCE2VT.get(packet["X"], None)
order.status = STATUS_BINANCE2VT.get(data["X"], None)
order.price = float(data["L"])
order.time = data["O"]
order.symbol = data["s"]
@ -760,6 +755,7 @@ class BinanceTradeWebsocketApi(BinanceWebsocketApiBase):
""""""
self.gateway.on_account(data)
class BinanceDataWebsocketApi(BinanceWebsocketApiBase):
""""""