A trading bot built in Elixir. Based on frathon/hedgehog.
Run mix deps.get
to install the project dependencies.
If you see the following error: (CaseClauseError) no case clause matching ...
then it could mean that you are possibly using an outdated library. Try removing the _build
directory, reinstalling dependencies, recompiling the app and then trying again:
rm -rf _build
mix deps.get
iex -S mix
# now run the app again!
First add your Binance API keys to the app config file.
Also, in the same config file, set binance_client: Binance
(so that it uses the live client for trading and not the mock). If you want to use mock client then keep the config set to binance_client: BinanceMock
(so that real trades will not be placed in Binance).
Start the Postgress database running via Docker Compose:
docker-compose up
If you have not done so already, seed the database with the default config for all the symbols:
cd apps/naive
mix run priv/seed_settings.exs
You can check directly in the database using (at the password prompt its postgress
)
psql -Upostgres -hlocalhost
\c naive
\d settings
select id, symbol, budget, status from settings;
Now, start the interactive Elixir REPL:
cd apps/naive
iex -S mix
If you are using the BinanceMock
you can check its running.
Process.whereis(BinanceMock)
Now start the trader and then start streaming trade events for a symbol to the trader like so:
Streamer.start_streaming("NEOUSDT")
Naive.start_trading("NEOUSDT")
You can also start an Elixir observer like so (from within the iex session):
:observer.start()
NOTE If you have added your Binance API keys and you have USDT in your account (and you are using the live Binance app - not the BinanceMock) this process will BUY XRP and SELL the position immediately and then the bot will stop. Its just a test and not ment to make any money at all! :)