Пример #1
0
 def future_position(self, symbol, contractType):
     POSITION = "/api/v1/future_position.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'contract_type': contractType
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, POSITION, params)
Пример #2
0
 def cancel_order(self, symbol, orderId):
     CANCEL_ORDER_RESOURCE = "/api/v1/cancel_order.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'order_id': orderId
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, CANCEL_ORDER_RESOURCE, params)
Пример #3
0
 def order_info(self, symbol, orderId):
     ORDER_INFO_RESOURCE = "/api/v1/order_info.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'order_id': orderId
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, ORDER_INFO_RESOURCE, params)
Пример #4
0
 def future_trades_history(self, symbol, date, since):
     FUTURE_TRADES_HISTORY = "/api/v1/future_trades_history.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'date': date,
         'since': since
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, FUTURE_TRADES_HISTORY, params)
Пример #5
0
 def future_cancel(self, symbol, contractType, orderId):
     CANCEL = "/api/v1/future_cancel.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'contract_type': contractType,
         'order_id': orderId
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, CANCEL, params)
Пример #6
0
 def batch_trade(self, symbol, tradeType, orders_data):
     BATCH_TRADE_RESOURCE = "/api/v1/batch_trade.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'type': tradeType,
         'orders_data': orders_data
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, BATCH_TRADE_RESOURCE, params)
Пример #7
0
 def future_devolve(self, symbol, type, amount):
     FUTURE_DEVOLVE = "/api/v1/future_devolve.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'type': type,
         'amount': amount
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, FUTURE_DEVOLVE, params)
Пример #8
0
 def future_position_4fix(self, symbol, contractType, type1):
     POSITION_4FIX = "/api/v1/future_position_4fix.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'contract_type': contractType,
         'type': type1
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, POSITION_4FIX, params)
Пример #9
0
 def funds_transfer(self, symbol, amount, from_account, to_account):
     FUNDS_TRANSFER_RESOURCE = "/api/v1/funds_transfer.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'amount': amount,
         'from': from_account,
         'to': to_account
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, FUNDS_TRANSFER_RESOURCE, params)
Пример #10
0
 def order_history(self, symbol, status, currentPage, pageLength):
     ORDER_HISTORY_RESOURCE = "/api/v1/order_history.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'status': status,
         'current_page': currentPage,
         'page_length': pageLength
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, ORDER_HISTORY_RESOURCE, params)
Пример #11
0
 def future_batch_trade(self, symbol, contractType, orders_data, leverRate):
     BATCH_TRADE = "/api/v1/future_batch_trade.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'contract_type': contractType,
         'orders_data': orders_data,
         'lever_rate': leverRate
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, BATCH_TRADE, params)
Пример #12
0
 def future_orderinfo(self, symbol, contractType, orderId, status,
                      currentPage, pageLength):
     ORDERINFO = "/api/v1/future_order_info.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'contract_type': contractType,
         'order_id': orderId,
         'status': status,
         'current_page': currentPage,
         'page_length': pageLength
     }
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, ORDERINFO, params)
Пример #13
0
    def trade(self, symbol, tradeType, price='', amount=''):
        TRADE_RESOURCE = "/api/v1/trade.do"
        params = {
            'api_key': self.__apikey,
            'symbol': symbol,
            'type': tradeType
        }
        if price:
            params['price'] = price
        if amount:
            params['amount'] = amount

        params['sign'] = build_sign(params, self.__secretkey)
        return http_post(self.__url, TRADE_RESOURCE, params)
Пример #14
0
 def future_trade(self,
                  symbol,
                  contractType,
                  price='',
                  amount='',
                  tradeType='',
                  matchPrice='',
                  leverRate=''):
     TRADE = "/api/v1/future_trade.do"
     params = {
         'api_key': self.__apikey,
         'symbol': symbol,
         'contract_type': contractType,
         'amount': amount,
         'type': tradeType,
         'match_price': matchPrice,
         'lever_rate': leverRate
     }
     if price:
         params['price'] = price
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, TRADE, params)
Пример #15
0
 def future_userinfo_4fix(self):
     INFO_4FIX = "/api/v1/future_userinfo_4fix.do"
     params = {'api_key': self.__apikey}
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, INFO_4FIX, params)
Пример #16
0
 def future_userinfo(self):
     USERINFO = "/api/v1/future_userinfo.do"
     params = {}
     params['api_key'] = self.__apikey
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, USERINFO, params)
Пример #17
0
 def userinfo(self):
     USERINFO_RESOURCE = "/api/v1/userinfo.do"
     params = {}
     params['api_key'] = self.__apikey
     params['sign'] = build_sign(params, self.__secretkey)
     return http_post(self.__url, USERINFO_RESOURCE, params)