bitbns-official / bitbnspy

MIT License
9 stars 6 forks source link

How to execute a coin in USDT market via api #58

Closed sukhwant280 closed 3 years ago

sukhwant280 commented 3 years ago

Describe your environment

Your question

how to execute a coin in USDT market via api

import pandas as pd
import datetime as dt
import time
import numpy as np
import http.client
import json
from bitbnspy import bitbns
from BitbnsTradeSuggestions import tradexecute

key = ''
secretKey = ''
bitbnsObj = bitbns(key, secretKey)

tdticker1 = 'XRP_USDT'
tdtickerqty1 = 146.43
tdtickerprice1 = 0.6829

tdticker2 = 'XRP'
tdtickerqty2 = 146.43
tdtickerprice2 = 51

bitbnsObj.placeBuyOrder(tdticker1, tdtickerqty1, tdtickerprice1) 
time.sleep(5)
bitbnsObj.placeSellOrder(tdticker2, tdtickerqty2, tdtickerprice2)

Pleas note: Trade does not get executed, even if USDT of $100 is in the wallet. Rates mentioned in the Ask to buy and bid to sell are present in the order book

Please opine

sukhwant280 commented 3 years ago

OR i should use the fromat of Bracket execution order to place a simple order?

sanket-buyhatke commented 3 years ago

placeBuyOrder only supports INR pairs which is version 1 please use placeOrders which supports both INR and USDT pairs, which is version 2.

yes, you can use the bracket order format, all fields are not necessary, you use only what is required for a simple order. e.g.

#to place a simple buy order for USDT pairs
bitbnsObj.placeOrders({'symbol': 'XRP_USDT', 'side': 'BUY', 'quantity': 146.43, 'rate': 0.6829}))
sukhwant280 commented 3 years ago

thanks its working now