[Add] 完成OkexFutureApi.queryOrders
This commit is contained in:
parent
0ee13bf862
commit
a396b55f8e
@ -6,6 +6,7 @@ from vnpy.api.okexfuture.vnokexFuture import OkexFutureRestBase
|
|||||||
from vnpy.network.RestClient import Request
|
from vnpy.network.RestClient import Request
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
class _OkexFutureCustomExtra(object):
|
class _OkexFutureCustomExtra(object):
|
||||||
|
|
||||||
def __init__(self, onSuccess, onFailed, extra):
|
def __init__(self, onSuccess, onFailed, extra):
|
||||||
@ -14,26 +15,20 @@ class _OkexFutureCustomExtra(object):
|
|||||||
self.extra = extra
|
self.extra = extra
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
class OkexFuturePriceType(Enum):
|
class OkexFuturePriceType(Enum):
|
||||||
Buy = 'buy'
|
Buy = 'buy'
|
||||||
Sell = 'sell'
|
Sell = 'sell'
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
class OkexFutureContractType(Enum):
|
class OkexFutureContractType(Enum):
|
||||||
ThisWeek = 'this_week'
|
ThisWeek = 'this_week'
|
||||||
NextWeek = 'next_week'
|
NextWeek = 'next_week'
|
||||||
Quarter = 'quarter'
|
Quarter = 'quarter'
|
||||||
|
|
||||||
|
|
||||||
class OkexFutureStatus(Enum):
|
########################################################################
|
||||||
NoTraded = '0'
|
|
||||||
PartialTraded = '1'
|
|
||||||
AllTraded = '2'
|
|
||||||
Canceled = '-1'
|
|
||||||
CancelProcessing = '4'
|
|
||||||
Canceling = '5'
|
|
||||||
|
|
||||||
|
|
||||||
class OkexFutureOrderType(Enum):
|
class OkexFutureOrderType(Enum):
|
||||||
OpenLong = '1'
|
OpenLong = '1'
|
||||||
OpenShort = '2'
|
OpenShort = '2'
|
||||||
@ -41,8 +36,16 @@ class OkexFutureOrderType(Enum):
|
|||||||
CloseShort = '4'
|
CloseShort = '4'
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
class OkexFutureOrderStatus(Enum):
|
||||||
|
NotFinished = '1'
|
||||||
|
Finished = '2'
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
class OkexFutureOrder(object):
|
class OkexFutureOrder(object):
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.volume = None
|
self.volume = None
|
||||||
self.contractName = None
|
self.contractName = None
|
||||||
@ -59,8 +62,10 @@ class OkexFutureOrder(object):
|
|||||||
self.unitAmount = None
|
self.unitAmount = None
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
class OkexFutureUserInfo(object):
|
class OkexFutureUserInfo(object):
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.accountRights = None
|
self.accountRights = None
|
||||||
self.keepDeposit = None
|
self.keepDeposit = None
|
||||||
@ -69,15 +74,19 @@ class OkexFutureUserInfo(object):
|
|||||||
self.riskRate = None
|
self.riskRate = None
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
class OkexFuturePosition(object):
|
class OkexFuturePosition(object):
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
def __init__(self, ):
|
def __init__(self, ):
|
||||||
self.forceLiquidatePrice = None
|
self.forceLiquidatePrice = None
|
||||||
self.holding = [] # type: List[OkexFuturePositionDetail]
|
self.holding = [] # type: List[OkexFuturePositionDetail]
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
class OkexFuturePositionDetail(object):
|
class OkexFuturePositionDetail(object):
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
def __init__(self, ):
|
def __init__(self, ):
|
||||||
self.buyAmount = None
|
self.buyAmount = None
|
||||||
self.buyAvailable = None
|
self.buyAvailable = None
|
||||||
@ -206,10 +215,12 @@ class OkexFutureRestClient(OkexFutureRestBase):
|
|||||||
callback=self.onOrder,
|
callback=self.onOrder,
|
||||||
data=data,
|
data=data,
|
||||||
extra=_OkexFutureCustomExtra(onSuccess, onFailed, extra))
|
extra=_OkexFutureCustomExtra(onSuccess, onFailed, extra))
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# todos: complete this
|
def queryOrders(self, symbol, contractType, status,
|
||||||
def queryOrders(self, symbol, contractType, orderId, onSuccess, onFailed=None,
|
onSuccess, onFailed=None,
|
||||||
extra=None): # type: (str, OkexFutureContractType, str, Callable[[OkexFutureOrder, Any], Any], Callable[[Any], Any], Any)->Request
|
pageIndex=None, pageLength=50,
|
||||||
|
extra=None): # type: (str, OkexFutureContractType, OkexFutureOrderStatus, Callable[[OkexFutureOrder, Any], Any], Callable[[Any], Any], int, int, Any)->Request
|
||||||
"""
|
"""
|
||||||
:param symbol: str
|
:param symbol: str
|
||||||
:param contractType: OkexFutureContractType
|
:param contractType: OkexFutureContractType
|
||||||
@ -222,8 +233,13 @@ class OkexFutureRestClient(OkexFutureRestBase):
|
|||||||
data = {
|
data = {
|
||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'contractType': contractType,
|
'contractType': contractType,
|
||||||
'order_id': orderId
|
'status': status,
|
||||||
|
'order_id': '-1',
|
||||||
|
'pageLength': 50
|
||||||
}
|
}
|
||||||
|
if pageIndex:
|
||||||
|
data['page_index'] = pageIndex
|
||||||
|
|
||||||
return self.addReq('POST',
|
return self.addReq('POST',
|
||||||
'/future_order_info.do',
|
'/future_order_info.do',
|
||||||
callback=self.onOrder,
|
callback=self.onOrder,
|
||||||
|
Loading…
Reference in New Issue
Block a user