def orderinfo(self, symbol, order_id): order_info_resource = "/api/v1/order_info.do" params = { 'api_key': self.__apikey, 'symbol': symbol, 'order_id': order_id } params['sign'] = build_my_sign(params, self.__secretkey) return http_post(self.__url, order_info_resource, params)
def cancel_order(self, symbol, order_id): cancel_order_resource = "/api/v1/cancel_order.do" params = { 'api_key': self.__apikey, 'symbol': symbol, 'order_id': order_id } params['sign'] = build_my_sign(params, self.__secretkey) return http_post(self.__url, cancel_order_resource, params)
def batch_trade(self, symbol, trade_type, orders_data): batch_trade_resource = "/api/v1/batch_trade.do" params = { 'api_key': self.__apikey, 'symbol': symbol, 'type': trade_type, 'orders_data': orders_data } params['sign'] = build_my_sign(params, self.__secretkey) return http_post(self.__url, batch_trade_resource, params)
def order_history(self, symbol, status, current_page, page_length): order_history_resource = "/api/v1/order_history.do" params = { 'api_key': self.__apikey, 'symbol': symbol, 'status': status, 'current_page': current_page, 'page_length': page_length } params['sign'] = build_my_sign(params, self.__secretkey) return http_post(self.__url, order_history_resource, params)
def trade(self, symbol, trade_type, price='', amount=''): trade_resource = "/api/v1/trade.do" params = { 'api_key': self.__apikey, 'symbol': symbol, 'type': trade_type } if price: params['price'] = price if amount: params['amount'] = amount params['sign'] = build_my_sign(params, self.__secretkey) return http_post(self.__url, trade_resource, params)
def userinfo(self): userinfo_resource = "/api/v1/userinfo.do" params = {'api_key': self.__apikey} # params['api_key'] = self.__apikey params['sign'] = build_my_sign(params, self.__secretkey) return http_post(self.__url, userinfo_resource, params)