ctubio / tribeca

Self-hosted crypto trading bot (automated high frequency market making) in node.js, angular, typescript and c++
https://127.0.0.1:3000
Other
95 stars 26 forks source link

New option: width in % #96

Closed Camille92 closed 7 years ago

Camille92 commented 7 years ago

Hello Carles,

I thought about that as a complement/replacement of the second point of #90.

The idea is that now using Stdev as a protection for width, I just use the width setting to be sure I don't trade under the fees, so I put width being an approximation of the fee I'm paying.

I also think it can be useful for everyone if you want to fix a target to do market making without worrying about the price going to much up of down and having your width becoming irrelevant.

The calculation would be width in base currency = ('% Set by the user' * 100) / FV

And as we now we have a lot of settings in % I think it's easy to implement in line with the already existing options:)

Tell me what you think,

Camille

ctubio commented 7 years ago

so the width % will be based on the FV? im not getting why.. is because the fees in the exchanges are based on the % from the current prices too?

thanks for confirm'¡

Camille92 commented 7 years ago

Yes, the fee is based on the current price and also width depends on the price!

If you sell a bitcoin at the current price ($2200) in the BTC/USD market being a maker with a 0.1% fee you'll pay $2.2 in fee. If you sell this same bitcoin at $1000 you would only pay $1 in fee :)

Now for the relationship with the width I give you an example, a width of 10 USD in the BTC/USD market is smaller than a width of 1 USD in the LTC/USD market in percentage. It means that if you're doing market making you're going to make more money on LTC.

1 bitcoin = 2200 USD and a width of 10 = 0.45% of the price 1 LTC = 30 usd and a width of 1 = 3.33% of the price.

As we're paying the fees as a percentage of the good (so a percentage of its exchange price) if I want to make money in a market with a 0.1% maker fee, I have to be sure that the width is superior to 0.2% (0,1% for buying and 0.1% for selling).

The way I used to do it was to calculate a target given the current price, but with the recent huge price swing, my width can become quickly irrelevant if the price double or is divided by 2.

By having the width in % I can be sure that whatever happens on the market I'll still have a target over my fees!

ctubio commented 7 years ago

i think the formula should be ('% Set by the user' * FV) / 100

can you confirm? many thanks'¡

Camille92 commented 7 years ago

Thank you! and yes your formula is the right one!