miro-ka / mosquito

Trading Bot with focus on Evolutionary Algorithms and Machine Learning
GNU General Public License v3.0
260 stars 53 forks source link

Add Max per trade buy/sell mode #30

Closed crack00r closed 6 years ago

crack00r commented 6 years ago

pls add a option for maxusage of BTC/Currency per trade else he cant buy in good signals

want to buy BTC_XMR, not enough money, or everything already bought..
Sun Jul 30 17:45:00 2017, close:0.000347, | 13.4475573574ETH | $: 0.01%, b&h: 0.0%
getting offline ticker for total pairs: 64 , epoch: 1501407997
dataset_cnt: 181
want to buy BTC_XMR, not enough money, or everything already bought..
Sun Jul 30 17:45:00 2017, close:0.000347, | 13.4475573574ETH | $: 0.01%, b&h: 0.0%
getting offline ticker for total pairs: 64 , epoch: 1501408057
dataset_cnt: 182
want to buy BTC_XMR, not enough money, or everything already bought..
Sun Jul 30 17:45:00 2017, close:0.000347, | 13.4475573574ETH | $: 0.01%, b&h: 0.0%
getting offline ticker for total pairs: 64 , epoch: 1501408117
dataset_cnt: 183
want to buy BTC_XMR, not enough money, or everything already bought..
Sun Jul 30 17:45:00 2017, close:0.000347, | 13.4475573574ETH | $: 0.01%, b&h: 0.0%
getting offline ticker for total pairs: 64 , epoch: 1501408177
^Cshutting down and writing final statistics!
Plot: Empty dataframe, nothing to draw!
Couldn't find exchange rate for: ETH

****************************************************
*           Final simulation report:               *
****************************************************
Wallet at Start: | 1.0BTC |
Wallet at End: | 13.4475573574ETH |
Strategy result: -100.0%
Buy & Hold: 0.0%
Strategy vs Buy & Hold: -100.0%
Total txn: 1
Simulated (data time): -2 days, 9 hours and 0 minutes
Transactions per hour: -0.03
Simulation run time: 0 hours 8 minutes and 55 seconds
miro-ka commented 6 years ago

I'm sorry but can you give me an example (not 100% sure what you mean)?

crack00r commented 6 years ago

right now, it use 100% of the BTC/Trade But a option for only use 10% ore a fixed 0.1BTC/Trade of all would be better so the bot can trade multiple coins in the same time

crack00r commented 6 years ago

here is an bot-try from me https://github.com/crack00r/BitBot/blob/master/config.ini AMOUNT_BTC_PER_TRADE: 0.1

miro-ka commented 6 years ago

Currently now TradeAction should support following 'modes':

  1. user defined amount: Uses user defined amount. Example TradeAction('BTC_ETH', TradeState.buy, amount=0.5, rate=close_price)
  2. buy_sell_all: Uses for buy/sell 100% of available amount. For example TradeAction('BTC_ETH', TradeState.buy, amount=None, rate=close_price, buy_sell_all=True)

And I think, that #1 'mode' is what you are after. Am I correct?

crack00r commented 6 years ago

pls add a option for buy_sell_all/userdefined

miro-ka commented 6 years ago

The feature is already supported. You can change it in the strategy.

For example you can create new actions in following way:

For user defined amount : action = TradeAction(BTC_DOGE, TradeState.buy, rate=0.0001, amount=200)

For buy_sell_all: action = TradeAction(BTC_DOGE, TradeState.buy, rate=0.0001, buy_sell_all=True) This will see how much BTC you have in your wallet and use the entire amount to buy DOGE.

crack00r commented 6 years ago

thats wrong...

        close_pair_price = look_back.loc[look_back['pair'] == winner_pair].sort_values('date').close.iloc[0]
        action = TradeAction(winner_pair,
                             TradeState.buy,
                             amount=0.05,
                             rate=close_pair_price,
                             buy_sell_all=False)
sorted_indicators: [('BTC_POT', 1.9586624596234199), ('BTC_OMNI', 1.4485271178363033), ('BTC_DASH', 0.86299293514073405), ('BTC_DCR', 0.3330482368286663), ('BTC_RIC', 0.31055900621116661), ('BTC_LBC', 0.094769319618141723)]
Processing live-action: TradeState.buy, amount: 0.05, pair: BTC_POT, rate: 3.234e-05, buy_sell_all: False
Setting buy order: 0.05BTC_POT
Got exception: Total must be at least 0.0001. Txn: buy-BTC_POT

as you can see, it try to buy an amount of 0.05 of POT at 3234sat, but you have to add a option to set max_amount_of_BTC_per_Trade - ore something else to get max_amount_of_BTC_per_Trade / RATE = amount

miro-ka commented 6 years ago

The exception you are getting is an exception from Poloniex, where it is saying that the transaction amount you are trying to make is under their minimum BTC allowed amount.

Are you trying to add a logic where the bot would make on order where it would automatically place minimum_allowed_amount? Sorry, still not 100% sure if I understand that what are you trying to achieve.

crack00r commented 6 years ago

i just dont want to invest 100% of all BTC that i have into 1 trade, i want to spread it into all good signals

miro-ka commented 6 years ago

Suggesting to add following modes:

1) buy_sell_all 2) buy_percent (use specific % of your assets) 3) buy_fixed_amount 4) user_defined (amount will be specified by user) - this could be default

crack00r commented 6 years ago

buy_sell_all - cant spread over more coins buy_percent (use specific % of your assets) - % of assets is useless, the amount will allways be different and at the end you have to small amount=> 10% of a100 isnt the same of 10% of 90 => **** buy_fixed_amount - Best !! user_defined (amount will be specified by user) - this could be default - fixed amount

miro-ka commented 6 years ago

fixed