gazbert / bxbot

A simple Bitcoin trading bot written in Java.
MIT License
779 stars 275 forks source link

Not sure if it's a bug on Windows #51

Closed redbeardpackie closed 7 years ago

redbeardpackie commented 7 years ago

Not sure if it's a bug on Windows but no matter what value I put in the btc-buy-order-amount in the strategies.xml file this is what I see: (I'm configured to connect to Bitfinex.) "message":"Invalid order: minimum size for BTC/USD is 0.01"

Has anyone else seen this?

Thanks for any help you can provide!

gazbert commented 7 years ago

Hi, it shouldn't be a Windows issue. The code that reads the config files and sends the orders is the same for all exchange adapters and is not OS specific.

Can you post your strategies.xml and market.xml config?

Not sure about this one - the order creation code is common, so I'd expect my bots to be failing on GDAX, BTC-e, etc...

I've not been running bots on Bitfinex for a while, but I'll try and spin one up tomorrow and take a look.

redbeardpackie commented 7 years ago

Hello gazbert, Thank you for your help! I changed the .xml files to .txt so I could upload them. I have kept most configuration files almost unchanged except for my exchange key and secret. My intention is to get the bot up and running before I tweak it.

markets.txt strategies.txt

gazbert commented 7 years ago

Just took a look at your markets confg - the market.id and market.counter-currency will not work for Bitfinex, because the exchange does not include GBP in currency pairs:

https://www.bitfinex.com/stats

If you want to trade USD/BTC, then:

market.id = btcusd market.counter-currency = USD

Market ids (trading pair symbols) are here: https://bitfinex.readme.io/v1/reference#rest-public-symbols

Sample config for Bitfinex here: https://github.com/gazbert/bxbot/blob/master/config/samples/bitfinex/markets.xml

HTH! G

redbeardpackie commented 7 years ago

Hello gazbert,

Sorry for the delay, I'm just getting back to this. I have checked my markets.xml against the sample config and they are identical. However I'm still getting the same message. Are you able to connect to Bitfinex and place an limit order?

Thank you,

Patrick

gazbert commented 7 years ago

Hi Patrick, I've not got bots running on 'finex at the moment, but I'll spin one up over the weekend and get back to you... In the meantine, have you tried another exchange? I've got bots running on GDAX, BTC-e, stamp, ItBit, Gemini, and Kraken using the last Release build.

gazbert commented 7 years ago

Hi Patrick. I've just sent a sell order in for 0.01 BTC @ $1650 and it worked successfully. I'm using the latest Release of the bot and also tested off the head of the branch.

Can you run the bot in debug and send an order in and then attach the log file?

Open the \<project-root>/config/log4j2.xml file and change: <Root level="info"> to be: <Root level="debug"> ... and then restart the bot.

Please make sure that you remove any API credentials (if you're logging them) and any lines in the log containing "X-BFX-" before attaching attaching the log file.

redbeardpackie commented 7 years ago

Hi gazbert, Thank you for trying an order on Bitfinex. Here's where I'm at, first I tried a different exchange (GDAX), and for the bot version: bxbot-app-0.5-beta.3, I receive the same error about the order size being too small. So I downloaded and built the latest version: bxbot-app-0.6.1 in a different folder on the same computer and the java window runs for a while and then closes, so I'm not sure what to make of that. I did change the log file output from info to debug. I will upload both log files for your reading pleasure :-).

Thank you for your help!

Patrick

This file is from the 0.5-beta.3 version. bxbot.log.txt

This file is from the 0.6.1 version. bxbot.log.txt

gazbert commented 7 years ago

Hi Patrick, lets stick with the latest 0.6.1 version for now and get you up and running on GDAX. I'm trading on the BTC/GBP market with the same version of the bot.

The bot failed to start because of a duplicate market id in your markets.xml file.

15412 [main] 2017-05-02 13:55:30,441 INFO TradingEngine loadMarketConfigAndInitialiseTradingStrategies() - Fetched Markets config from repository: [MarketConfig{label=BTC/USD, id=btc_usd, baseCurrency=BTC, counterCurrency=USD, enabled=true, tradingStrategy=scalping-strategy}, MarketConfig{label=BTC/USD, id=btc_usd, baseCurrency=BTC, counterCurrency=USD, enabled=true, tradingStrategy=scalping-strategy}]

You'll need to remove one of them.

In your strategies.xml file, make sure the counter-currency-buy-order-amount value (USD) is high enough to be able to buy 0.01 BTC - you'll need to factor in the exchange buy fee too. At 22:11 BST today, you'd need approx $15-$16 + buy fee (0.25%).

If you attach the logs for GDAX and Bitfinex (v0.6.1) + market.xml and strategies.xml files, I'll try and have a look at them after work one night this week...

See where we go from there. Worst case, I'll zip up my Bitfinex bot and attach it here for you to take a look at the config etc.

Cheers!

redbeardpackie commented 7 years ago

Hi gazbert, I would like to report that I finally found what was missing in the log file and my bot is alive!I really appreciate your efforts in helping me to get the bot running!Should I make a profit I'd be more than happy to donate to your BTC address if you can post it :-). Have you thought about using a MACD strategy or possibly adding margin trading functionality? Thank you, Patrick On Tuesday, May 2, 2017, 3:19:39 PM MDT, Gareth Lynch notifications@github.com wrote: Hi Patrick, lets stick with the latest 0.6.1 version for now and get you up and running on GDAX. I'm trading on the BTC/GBP market with the same version of the bot.

The bot failed to start because of a duplicate market id in your markets.xml file.

15412 [main] 2017-05-02 13:55:30,441 INFO TradingEngine loadMarketConfigAndInitialiseTradingStrategies() - Fetched Markets config from repository: [MarketConfig{label=BTC/USD, id=btc_usd, baseCurrency=BTC, counterCurrency=USD, enabled=true, tradingStrategy=scalping-strategy}, MarketConfig{label=BTC/USD, id=btc_usd, baseCurrency=BTC, counterCurrency=USD, enabled=true, tradingStrategy=scalping-strategy}]

You'll need to remove one of them.

In your strategies.xml file, make sure the counter-currency-buy-order-amount value (USD) is high enough to be able to buy 0.01 BTC - you'll need to factor in the exchange buy fee too. At 22:11 BST today, you'd need approx $15-$16 + buy fee (0.25%).

If you attach the logs for GDAX and Bitfinex (v0.6.1) + market.xml and strategies.xml files, I'll try and have a look at them after work one night this week...

See where we go from there. Worst case, I'll zip up my Bitfinex bot and attach it here for you to take a look at the config etc.

Cheers!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

gazbert commented 7 years ago

Hi Patrick, glad to hear you're up and running!

I'm about to create a new release with some updates to improve the sample config documentation and simplify the sample algo. Might be worth a look as the percentage gain is now configurable in the sample strategies.xml.

Yes, I have a MACD strat and various other strats running. The sample strat is really only there to get folks up and running - you'll definitely want to write your own, but it should serve as good boiler plate starter code.

As for margin (and futures) trading, I made the decision not to support it in the Trading API due to the complexity and risk involved - I just wanted a simple spot trading bot I could leave running and forget about ;-) But feel free to fork the code and have a crack at it!

All the best G