Abhisheksoni1 / BitmexBot

MIT License
81 stars 37 forks source link

Leverage trading #4

Open adacumos opened 6 years ago

adacumos commented 6 years ago

Is leverage trading supported?

LAPPLS commented 6 years ago

yes it is there is cross margin of 10

adacumos commented 6 years ago

Thanks @Lappls but where can I find settings for leverage to use? I couldn't find anything defined on settings.py

Abhisheksoni1 commented 6 years ago

there is a method inside the codes for setting cross-margin in the system

Abhisheksoni1 commented 6 years ago

it defaults to 10 so there is no method or something inside setting.py file

adacumos commented 6 years ago

Thanks @Abhisheksoni1 btw thanks for this awesome project. It does need allot of improvement though. I'm looking at using TA-Lib so the bot can use different indicators. Will do a pr once done.

Abhisheksoni1 commented 6 years ago

Thank you @cofibit it means alot, Yeah we can work on TA-Lib let me know if you need my help in this i am happy to code with you :D

adacumos commented 6 years ago

Hi @Abhisheksoni1 is this the method you were referring to on setting the leverage?

bitmex_bot/bitmex.py

@authentication_required def isolate_margin(self, symbol, rethrow_errors=False): """Set the leverage on an isolated margin position""" path = "position/isolate" postdict = { 'symbol': symbol, 'enabled': False } return self._curl_bitmex(path=path, postdict=postdict, verb="POST", rethrow_errors=rethrow_errors)

So I just need to set enabled to True? you said that the default is 10 but where is the default leverage value value defined?

hashtagex commented 6 years ago

I was trying to figure out the exact same thing let me know if you find something.

adacumos commented 6 years ago

@hashtagex yes on bitmex.py there's a method named isolate_margin just set enabled to True as per @Abhisheksoni1 by default it is set to 10x leverage, I'm not sure if it does get whatever leverage you set on your account or it is hard coded to 10x.

hashtagex commented 6 years ago

@cofibit Great I actually see this in the code before, so I'll look into it again. Thanks for the tip. Would be great if we could get bitmex running on freqtrade. I tried before but I was having trouble getting it to recognize the xbt symbol. Anyways I'll try this out.

adacumos commented 6 years ago

@hashtagex yeah was trying to make bitmex work on freqtrade but was throwing allot of errors reason is that bitmex pairs are not the same with bittrex/binance format. Also this is much better than freqtrade since it is using websocket. Ccxt just polls servers and is subjected to limits.

hashtagex commented 6 years ago

@cofibit true, I can agree with you there. It's just limited, I like seeing and being able to control on the go. But I ran the default bot live for a bit with a few changes to the indicator numbers and didn't do too bad. I was trying to add some of my own as well, but haven't been able to implement them in the bitmex.py file. I see your trying to implement talib. That would be great. I was def not getting anywhere when I was trying, but I'm not a pro, I just get around and learning everyday.

masterkain commented 6 years ago

when the bot starts it resets to Cross, should I just change the leverage through bitmex ui? using latest master, thanks

masterkain commented 6 years ago

nm, tried the True value in the isolate method and started out with 50x, thanks