Suoritettu

Python code to trade cryptocurrencies using bitmex APIs

Currently I have a program that I got on the internet and I want to fix it.

the program is written in python and is made to interact with bitmex through its API and Key.

The program must do the following 6 things:

1) show candlesticks from a specific period

2) calculate the simple moving average

3) show bid and ask from order book

4) show balances

5) cancel orders

6) place orders

for better understanding I am attaching part the program that I have:

class bitmex(object):

BASE_URL = "[login to view URL]"

KEY = "XXX"

SECRET = "ZZZ"

def sma(self,candles,period):

if len(candles)>=period:

sma=[]

added=0.0

i=period-1

j=0

i_temp=0

while j<len(candles)-period+1:

i_temp=i

added=0

while i>=j:

added=added+candles[i]

i-=1

[login to view URL](added/period)

i=i_temp

i+=1

j+=1

for avg in sma:

print("Simple Moving Average : ", avg)

return sma

def candlestick(self):

url = self.BASE_URL + "/trade/bucketed?binSize=5m&partial=false&symbol=XBTUSD&count=100&reverse=false"

response = [login to view URL]("GET", url)

if response.status_code == 200:

data=[login to view URL]()

candles=[]

for ohlc in data:

if str(ohlc["close"])!="None":

[login to view URL](ohlc["close"])

if len(candles)>0:

[login to view URL](candles,20)

else:

print('error, status_code = ', response.status_code)

def _nonce(self):

return str(int(round([login to view URL]()) + 5))

def _signer(self,verb, url, expires, data):

parsedURL = urlparse(url)

path = [login to view URL]

if [login to view URL]:

path = path + '?' + [login to view URL]

if isinstance(data, (bytes, bytearray)):

data = [login to view URL]('utf8')

message = verb + path + str(expires) + data

return [login to view URL]([login to view URL]('utf8'),[login to view URL]('utf8'),digestmod=[login to view URL]).hexdigest()

def _headers(self,verb, path, expires, data):

return {

"api-expires": str(expires),

"api-key": [login to view URL],

"api-signature": self._signer(verb, path, expires, data),

}

def balance(self):

nonce=self._nonce()

verb='GET'

path="/api/v1/user/margin"

data={

'currency': 'XRP'

}

headers=self._headers(verb,path,nonce,'')

response = [login to view URL](self.BASE_URL + "/user/margin",headers=headers,data=[login to view URL](data),verify=True)

if response.status_code == 200:

data=[login to view URL]()

if data["currency"]=="XBt":

print("Balance XBt : ",data["amount"])

else:

data=[login to view URL]()

print('error, status_code = ', response.status_code)

def neworder(self):

nonce=self._nonce()

verb='POST'

path="/api/v1/order"

data={

'symbol': 'XBTUSD',

'side': 'Buy',

'orderQty': '0.0',

'price': '0',

'ordType': 'Limit'

}

headers=self._headers(verb,path,nonce,'')

response = [login to view URL](self.BASE_URL + "/order",headers=headers,data=[login to view URL](data),verify=True)

if response.status_code == 200:

data=[login to view URL]()

print(data)

else:

data=[login to view URL]()

print(data)

print('error, status_code = ', response.status_code)

Taidot: Python

Näytä lisää: crypto trading platform, bitmex trading bot github, bitmex api v1 order, binance api, binance python api, bitcoin trading site, python cryptocurrency api, bitmex api usa, simple code conversion currency using compiler, php ajax code file uploading using progress bar, free code recording desktop using, sample code video streaming using java, source code ftp file using inet control, code ecommerce website using aspnet, free source code pharmacy project using vb6, code search field using extjs, code receiving sms using commands, code data layer using vbnet, example code popup balloon using javascript, programming code bid system using aspnet

Tietoa työnantajasta:
( 2 arvostelua ) Cartagena, Colombia

Projektin tunnus: #26419131

Myönnetty käyttäjälle:

garrettpeuse

I have a lot of experience in this field. I am trader and also build trading systems. Right now I have a trading bot working with the broker Kraken, making more than 6% a month. I understand the cryptomarket on a deep Lisää

$10 USD 7 päivässä
(0 Arvostelua)
0.0

6 freelanceria on tarjonnut keskimäärin 43$ tähän työhön

ajitbhalerao74

Hello sir I have worked with bitmex api before and have generated candlestick charts [login to view URL] web sockets I went through your code and I think I can deliver what you need.

$111 USD 2 päivässä
(7 arvostelua)
2.9
Imedvedev32

Hi, thanks for your post! I am a full-stack developer with 7 years of Desktop App development experience. I read description of job post and I can complete it completely. Especially, As you can see on my review ,I am Lisää

$30 USD 7 päivässä
(2 arvostelua)
2.5
reosoft21

Hi, "I have gone through your description. "This is my area of specialization, i can get it done perfectly well. Please ping me in person. I can help you to complete all tasks. I and my team have hands-on experience i Lisää

$55 USD 1 päivässä
(0 arvostelua)
0.0
Neiev

I analyzed your project and noticed that I have the necessary training and skills for an effective development, of high quality and in the shortest possible time. Visit my profile for more information. Thanks for liste Lisää

$30 USD 7 päivässä
(0 arvostelua)
0.0
rodrigocasagrand

ABOUT THE PROJECT I have already developed python scripts that can connect to finance sources and create strategies / indicators. I have never worked with bitmex specifically but I think I can help you out with any ta Lisää

$20 USD 3 päivässä
(0 arvostelua)
0.0