Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting Exchanges (info) #5

Closed
germangar opened this issue Sep 15, 2023 · 15 comments
Closed

Requesting Exchanges (info) #5

germangar opened this issue Sep 15, 2023 · 15 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@germangar
Copy link
Owner

germangar commented Sep 15, 2023

Adding new exchanges is a pretty simple proccess at this point. I will accept requests, but some conditions need to be met.

  • The exchange needs to be supported by ccxt.
  • If the exchange has a testnet I'll straight up give it a try.
  • If the exchange doesn't have a testnet I'll ask the person requesting it to create a subaccount, move 15USDT there and share the subaccount API keys with me (privately! trading permission only). I'll probably spend 2 or 3 USDT in trading fees during the implementation. Once it's done the subaccount can be deleted.

Note: I will not add Mexc. I already did, only to find out the exchange doesn't allow to place orders since 2022.

@germangar germangar added the documentation Improvements or additions to documentation label Sep 15, 2023
@germangar germangar self-assigned this Sep 15, 2023
@germangar germangar pinned this issue Sep 15, 2023
@a202037
Copy link

a202037 commented Sep 22, 2023

Hi, thanks for the development and it's a very nice repo. Is that possible to add support to krakenfutues ?

@germangar
Copy link
Owner Author

germangar commented Sep 24, 2023

Kraken futures added.

It has a couple of weaknesses compared to all the other exchanges, tho. Kraken doesn't offer a way to modify the margin mode from the API, so Whook won't set the margin to isolated as it does for every other exchange. The trades will happen in the margin mode the user has in the website.

Kraken doesn't either report the maximum leverage accepted for each symbol, so you have to careful not to exceed it or the order won't go through generating a bunch of spam in the console until the order times out.

Neither of these should be a big deal for algo trading. Other than these it's working fine. Both market and limit orders. It's perfectly usable.

PS: I only tested it in the testnet server trading with USD pairs. Kraken (as Binance) has futures blocked in my country.

@maddrid
Copy link

maddrid commented Oct 3, 2023

hi @germangar i can provide some bingx subaccount api
could you send me some details how to contact you

@germangar
Copy link
Owner Author

germangar commented Oct 3, 2023

Hey, thank you! You can send me an email to germangarciaart(AT)gmail.com

@AlexanderWatersOxygen
Copy link

First off all thanks!!! Got it to work on kucoin, but on bybit it gives an error. So it seems to reocognize two open posititions
but trading doesn't work. Have you had this problem before and do you know how to solve it?

23:13:29 Initializing account: [ BYBIT__AlexW_G_main ] in [ bybit ]

2 positions found.

  • W: refreshPositions: Could not get marginMode for ARB/USDT:USDT
  • W: refreshPositions: Could not get marginMode for ETC/USDT:USDT
    Account creation failed: can only concatenate str (not "NoneType") to str <class 'TypeError'>

Warm regards,

Alexander

@germangar
Copy link
Owner Author

Hello. I haven't used Bybit in quite a while. Probably something has changed in either ccxt or the exchange that has triggered a bug. I'll take a look into it in the next few days.

@germangar
Copy link
Owner Author

germangar commented Mar 25, 2024

@AlexanderWatersOxygen I committed a quick fix. Update and it should work fine.

@AlexanderWatersOxygen
Copy link

@AlexanderWatersOxygen I committed a quick fix. Update and it should work fine.

that is amazing!! Thanks

@AlexanderWatersOxygen
Copy link

the error is above is resolved, but i encountered a one with placing orders.
So the first part; reading the account info works

19:26:31 Initializing account: [ BYBIT__AlexW_G_main ] in [ bybit ]

1 positions found.
BTC/USDT:USDT * cross:10x * short * 0.012 * 84.7642[$] * -0.08[$] * -0.09%

but when placing an order it says (i tried a few ways of webhook styles):

19:15:02 * E: Account ID not found. ALERT: BYBIT__AlexW_G_main btc/USDT:USDT 10$ buy 10x
19:30:44 * E: Account ID not found. ALERT: BYBIT__AlexW_G_main etc/USDT:USDT 100$ short 10x
19:31:21 * E: Account ID not found. ALERT: BYBIT__AlexW_G_main etc/USDT 100$ short 10x
19:35:46 * E: Account ID not found. ALERT: BYBIT__AlexW_G_main etcUSDT 100$ short 10x

ps feel a little bit bad to ask you again, but to get to your level of understanding the matter will take me few more years haha

@germangar
Copy link
Owner Author

germangar commented Mar 25, 2024

No, no. Don't feel bad. Please report these things. I don't use Bybit anymore and, while I try to check from time to time in a demo account, things in ccxt and the exchange always keep changing and my code may get a little outdated.

However, I tried placing and closing an order when I did the other fix and it was working for me. Is your ccxt version current?

I'll try to reproduce it and fix it when I have a moment.

Edit: I did a quick test and it works for me. So I don't think the problem is with the order itself. If it's not an issue with the ccxt version maybe there's something with the account name. I'll check that

21:21:27 [bybitdemo/bybit]
21:21:27 [bybitdemo/bybit]  ALERT: BTCUSDT bybitdemo 10$ buy 10x
21:21:27 [bybitdemo/bybit] ----------------------------
21:21:44 [bybitdemo/bybit]  * Order succesful: BTC/USDT:USDT buy 0.001 10x at price 74363.1 id 0e7b2910-44f3-4b65-b3a1-b290ae2f1c83
------------------------------
  1 positions found.
  BTC/USDT:USDT * isolated:10x * long * 0.001 * 7.0830[$] * -0.03[$] * -0.40%
------------------------------
21:22:49 [bybitdemo/bybit]
21:22:49 [bybitdemo/bybit]  ALERT: BTCUSDT bybitdemo pos 0$ 10x
21:22:49 [bybitdemo/bybit] ----------------------------
21:23:05 [bybitdemo/bybit]  * Order succesful: BTC/USDT:USDT sell 0.001 0x at price 67491.7 id e126cacf-4d12-4d72-adf4-5399d3ea342c
  0 positions found.
------------------------------

Oh. One thing. The symbol name must be all caps (That's one thing I can improve in the code)

21:26:54 [bybitdemo/bybit]
21:26:54 [bybitdemo/bybit]  ALERT: btc/USDT:USDT bybitdemo pos 10$ 10x
21:26:54 [bybitdemo/bybit] ----------------------------
21:26:54 [bybitdemo/bybit]  * E: Couldn't find symbol

But I don't think that's the reason for your issue since I only get a normal healthy syntax error.

I tried using the same account name as you to discard posibilities. It worked as expected

21:36:52 [BYBIT__AlexW_G_main/bybit]
21:36:52 [BYBIT__AlexW_G_main/bybit]  ALERT: btc/USDT:USDT BYBIT__AlexW_G_main buy 10$ 10x
21:36:52 [BYBIT__AlexW_G_main/bybit] ----------------------------
21:36:52 [BYBIT__AlexW_G_main/bybit]  * E: Couldn't find symbol
21:37:25 [BYBIT__AlexW_G_main/bybit]
21:37:25 [BYBIT__AlexW_G_main/bybit]  ALERT: BTC/USDT:USDT BYBIT__AlexW_G_main buy 10$ 10x
21:37:25 [BYBIT__AlexW_G_main/bybit] ----------------------------
21:37:35 [BYBIT__AlexW_G_main/bybit]  * Order succesful: BTC/USDT:USDT buy 0.001 10x at price 74355.8 id 2a954cd7-b503-4c6f-b9af-e3537a6e02c8
------------------------------
  1 positions found.
  BTC/USDT:USDT * isolated:10x * long * 0.001 * 7.0815[$] * 0.00[$] * 0.00%

@germangar
Copy link
Owner Author

germangar commented Mar 25, 2024

19:26:31 Initializing account: [ BYBIT__AlexW_G_main ] in [ bybit ]

1 positions found. BTC/USDT:USDT * cross:10x * short * 0.012 * 84.7642[$] * -0.08[$] * -0.09%

but when placing an order it says (i tried a few ways of webhook styles):

19:15:02 * E: Account ID not found. ALERT: BYBIT__AlexW_G_main btc/USDT:USDT 10$ buy 10x 19:30:44 * E: Account ID not found. ALERT: BYBIT__AlexW_G_main etc/USDT:USDT 100$ short 10x 19:31:21 * E: Account ID not found. ALERT: BYBIT__AlexW_G_main etc/USDT 100$ short 10x 19:35:46 * E: Account ID not found. ALERT: BYBIT__AlexW_G_main etcUSDT 100$ short 10x

Hold on. I notice your position is in cross margin mode. Did you open that position from the website or is your account setup for cross margin?
Can you check if the position in the website/app is showing as cross margin too?

Also. Can you paste here the lines when it initializates the account? It sounds like there was still an error at initialization.

@AlexanderWatersOxygen
Copy link

It worked. it was indeed the CCXT update! Many thanks for your assistance!
I opened indeed the position manually from the website to see if the positions where read ok.

It really works great. Really great job!!!

@AlexanderWatersOxygen
Copy link

After your last message I will take the liberty to request/ ask you something:

When placing a limit order is; is it possible to make it a 'Post Only' (or is that already the case?) because with a _maker order _ you could get super low fees :) of course with the risk orders don't get filled. :)

btw (as a side note. When you place a long order that balances out a short order and vise versa, you don't pay funding fees on a few exchanges i tested).
anyway the less fees the more likely a bot is profitable (if orders get filled of course :P) !!!!

@germangar
Copy link
Owner Author

I'm afraid only a few exchanges offer that possibility from the API. I checked Bybit documentation and I don't see how to do it.

If you use limit orders you will be a maker, but I think if the order is instantly triggered (the price was already in the range) it's not considered a maker, and that's where postOnly would make a difference.

I had the plan to make a special market order that would place the order as limit order checking the most recent price and using it, but it's a risky thing to use if the price is trending hard. I imagine only a percentage of orders would enter as maker, but it's better than nothing.

@AlexanderWatersOxygen
Copy link

I'm afraid only a few exchanges offer that possibility from the API. I checked Bybit documentation and I don't see how to do it.

If you use limit orders you will be a maker, but I think if the order is instantly triggered (the price was already in the range) it's not considered a maker, and that's where postOnly would make a difference.

I had the plan to make a special market order that would place the order as limit order checking the most recent price and using it, but it's a risky thing to use if the price is trending hard. I imagine only a percentage of orders would enter as maker, but it's better than nothing.

Ok thanks for looking into it, and your answer!
I didn't know that distinction of the price being in the range... but makes sense.

Yeah I reckoned that the might be problematic with trending markets and or ad hoc orders (that many bots have).

Already get an headache thinking about the complexity of programming, when having for example, a check if orders were filled, so that when you would place a opposite order (to avoid the funding fees), you don't end up shorting or longing a position that you wanted neutralized/ paid out, because a order was not (or not completely) filled. Anyways, a close order would always work :D

And contemplating on it, I guess that placing postOnly orders makes most sense when let's say you want to make predetermined exits or entries at for example support and resistance levels. But then you still would have to put in a trigger price and actual limit order price to be most sure they get filled right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants