Code Monkey home page Code Monkey logo

liquitrader's People

Contributors

k-kit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

liquitrader's Issues

Event Scheduler

Schedule upkeep tasks

  • check last time balances were updated, if greater than 1 min (time is subject to change, but sounds like a good interval) then fetch balances

Master Commander

  1. initialize config
  2. apply bull / bear override if enabled / conditions met
  3. parse candle time-frames from conditions
  4. generate condition objects from each strategy in config
  5. Initialize exchange with quote currency, time frames, api etc..
  6. exchange.update_balances()
  7. fetch trades and calculate averages for non zero values
  8. start exchange upkeep thread
  9. pass pairs to run technical analysis on all pairs and store indicator statistics in pairs['symbol']['indicators'] as dict
  10. pass pairs and config to master strategy analyzer
  11. process all buy strategies for each pair and return a list of possible_buys
    * evaluate each buy strategy
    * assign evaluation results to conditions dict in pair
    * each buy strategy returns amount or none, if multiple amounts are returned, take the largest and add to possible buys
  12. ^^ dca buys: append to dca_possible_buys
  13. process all sell strategies append to possible_sells
  14. DCA sells can just be appended to possible_sells
  15. temp balance = exchange.balances[quote_currency] (use temp variable to decrease need for api calls to update balance) (stores quote currency balance):
  16. for possible sells:
  17. check orderbook depth
    1. try to find highest price can sell
  18. make trades
  19. add trades to 'profit tracker'
  20. increment temp balance if trades are made
  21. for possible buys:
  22. check min buy balance, max pairs, 24h market change, quote_currency change (1h/24h)
    1. check order_book depth, only buy within max_spread % of price
    1. if checks pass return trade
    • update pair trade history
    • add trade to profit tracker
    • decrements temp balance
  23. use temp balance in checks for dca_buys (only run on pairs where amount > dust value)
  24. mostly the same as possible buys but with some dca specific checks
  25. run exchange.update_balances()
  • for coin balances where old coin_balance != coin_new balance
    • update pair[trades] exchange.client.fetchTrades(symbol)
    • calc averages
  1. ...profit?

dict: pairs
dict: indicators
** dict: stored_averages {average price, trades, last_trade_id, quantity}
dict: strategy_evals
** = requires data persistence

need to decide where to store DCA levels, possibly with stored averages?

also where to store pair trade history (pair trade list not the same as profit tracker, used for average calcs)

tests for websocket upkeep

automate testing to make sure sockets are being kept open without downtime
this can maybe be done by starting sockets, then killing internet, sleep 2-5min then reconnect to internet and test all sockets successfully reconnected

Master Strategy Analyzer

Tests:

  • various strategy combinations for each strategy type (buy/sell/dca)

    • ex. we have 3 buy strategies, which return the amount we want to buy, or none.
      1. evaluates to : 10
      2. evaluates to None
      3. evaluates to 100
  • the analyzer should return 100 in this instance, test for all orders and combinations.

First time init

  1. load user/pass/keys from text file into db
  2. database stuff
  3. find way to route to wizard on first run AND prevent navigating away from wizard
  4. do not start the liquitrader or exchange thread until wizard is complete
  • can work on this together if you'd like

exchange api error handling

  • ability to pause all bot function on error and handle accordingly
  • if rate limit error pause 60 sec first error, 5min subsequently
  • auto restart after non-rate-limit critical errors

condition editor: timeframes -> dropdown

use dropdown instead of input

  • this is mildly tricky because not all exchanges have the same timeframe, yet in the wizard we wont have access to which exchange is picked and what timeframes it has on the backend since it hasnt been set yet
    potential solution: ship gui with dict of exchange timeframes and pull exchange selected from wizard state

Flask server/api

WIP

  • Holding table:
    • symbol
    • ask price
    • bought_price
    • % change
    • volume
    • current value
    • dca level
    • trailing sell
    • dca trailing
    • 24h change
      • details for strategy evaluation
      • indicator values
      • and more will add later
  • Market
    • symbol
    • ask price
    • volume
    • trailing_buy
    • 24h change
      • ... details
  • buy history
    • tbd
  • sell history
    • tbd

New Condition Type: above/below

replace GAIN with
{A} ABOVE/BELOW {B} BY: {x}
x can be a number or a percent (will require changes in gui and condition_tools

Database for historical data

binance only allows you to fetch 500 candles at a time so we will need to create a historical database of candles for all pairs for backtesting

  • might only need for binance but tbd

Strategy Cards fixes

image

  1. if change is selected show "change over x"
  2. if right is number or price dont show timeframe

Data persistence

  • Pairs: DCA level(times DCA'd),
  • Average bought price + last buy trade ID + amount
  • Pair trade history
  • Bot Trade history/profit tracker (not yet implemented) (buy/sell log)
  • net balance at beginning of each day for days in buy/sell log

Generic Exchange: upkeep methods - issue

currently getting:

C:\Users\kylek\AppData\Local\Programs\Python\Python36\lib\asyncio\events.py:145: RuntimeWarning: coroutine 'GenericExchange._candle_upkeep' was never awaited
self._callback(*self._args)

Buy/sell log tracking

  • What conditions triggered + values for each trade

metrics

  • day profit
  • exponential
  • growth
  • daily profit
  • aggregate pair profit data (numtrades, total gain, avg % gain etc.)

binance: candle WS handler

change this function to fit CCXT fetchOHLCV form in order to make the candle_tic_to_df function work for both this and generic

considerations for GCA

Keep in mind the version of Bearpuncher GCA will use will require an API to add users, and set the users 'balance' in relation to the net balance of the account, which will effect what that users profit-tracker displays for returns. We will also need the users join date, and any subsequent deposits / balance changes that will effect the data required for the user

note this will not be in retail bearpuncher just something to keep in mind during the design process

Edit Condition Duplicate

Currently if you edit a condition and save it it creates a new condition, either needs to update old condition or delete.

indicator search modal

@luketimothyjones if you want to take some time and i'll go over the structure of the react code with you just let me know when

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.