Example #1
0
 def submit_order(self, type, currency_pair, price, amount):
     # https: // openapi.digifinex.vip / v2 / trade
     # POST参数:
     # symbol = usdt_btc
     # price = 6000.12
     # amount = 0.1
     # type = buy
     # apiKey = 59328e10e296a
     # timestamp = 1410431266
     # sign = 0a8d39b515fd8f3f8b848a4c459884c2
     SUBMITORDER_RESOURCE = '/v2/trade'
     timestamp = int(time.time())
     type = "buy" if (type == 1 or type == '1'
                      or str(type).lower() == "buy") else "sell"
     params = {
         'timestamp': timestamp,
         'type': type,
         'price': price,
         'amount': amount,
         'symbol': make_currency_pair_string(currency_pair)
     }
     params['sign'] = sign(self.account, params)
     result = requests.post(self.base_url + SUBMITORDER_RESOURCE,
                            data=params)
     result = universal.OrderInfo(self.MARKET, currency_pair, result.text, {
         'price': price,
         'amount': amount,
         'type': type
     })
     return result
Example #2
0
 def submit_order(self, type, currency_pair, price, amount):
     from packages import util
     aex2 = util.Client(self.account.api_key, self.account.secret_key, self.user_id)
     result = aex2.submitOrder(type,currency_pair.reference,price,amount,currency_pair.base)
     type="buy" if type==1 else "sell"
     result = universal.OrderInfo(self.MARKET, currency_pair, result, {'price':price,'amount':amount,'type':type})
     return result
Example #3
0
 def submit_order(self, type, currency_pair, price, amount):
     k = KRAKEN_RAW_API.API(key=self.account.api_key, secret=self.account.secret_key)
     pair_name='X'+Kraken.COINNAMEMAPPING.get(currency_pair.base, currency_pair.base) + 'Z' + Kraken.COINNAMEMAPPING.get(
     currency_pair.reference, currency_pair.reference)
     action='buy' if type>=1 or type=='1' or type=='buy' else 'sell'
     result = k.query_private('AddOrder',
                                     {'pair': pair_name,
                                      'type': action,
                                      'ordertype': 'limit',
                                      'price': str(price),
                                      'volume': str(amount)
                                      })
     result = universal.OrderInfo(self.MARKET, currency_pair, result, {'price':price,'amount':amount,'type':type})
     return result
Example #4
0
 def submit_order(self,
                  type="buy",
                  currency_pair='btc_usdt',
                  price='',
                  amount=''):
     if type == 1 or type == "1" or type.lower() == "buy":
         type = "buy"
     else:
         type = "sell"
     TRADE_RESOURCE = "/api/v1/trade.do"
     params = {
         'api_key': self.account.api_key,
         'symbol': currency_pair,
         'type': type
     }
     if price:
         params['price'] = price
     if amount:
         params['amount'] = amount
     p = params.copy()
     params['sign'] = buildMySign(params, self.account.secret_key)
     result = httpPost(self.base_url, TRADE_RESOURCE, params)
     result = universal.OrderInfo(self.__market, currency_pair, result, p)
     return result