Code Monkey home page Code Monkey logo

wolfinch's Introduction

|License|


Wolfinch

Wolfinch is a trading bot implemented in Python. It supports algorithmic trading for equity market and cryptocurrency exchanges. The modularized implementation is easily extensible to support more exchanges, trading strategies and indicators. A simple UI is available out of the box to view trades and allow basic controls in operation.

Features include :

  • Auto / Manual Trading Modes
  • Multiple decision engines
  • YAML based rich configuration file support - Tons of nuts and bolts to customize
  • Out of the box UI availability
  • Pluggable Strategies
  • Pluggable Indicators
  • Pluggable Exchanges
  • Backtesting support
  • Paper trading (Simulation) mode
  • Genetic optimizer support for tuning strategies
  • Machine Learning mode - supports training and using trained models and ML decision engines
  • Positional Stop Stop Loss support, multiple smart stop strategies available
    • Fixed Percent
    • Trailing with fixed percent
    • ATR trailing stop (with variable ATR period support)
    • Strategy provided
  • Positional Take profit support
    • Fixed percent
    • Strategy provided
  • Supports trading multiple exchanges at the same time
  • Supports trading multiple trading pairs at the same time
  • Supports cross exchange, cross pair trading (Using signals and indicators on one exchange/trading-pair to make trading decision on another exchange/trading-pair)
  • Restartability (of live trading, backtesting, genetic optimizer)

Using Wolfinch

Starting the bot is fairly straight forward.

A few examples below covers most startup modes:

  • Fresh start: Wolfinch.py --config <config.yml>
  • Restart from previous state: Wolfinch.py --config <config.yml> --restart
  • Import historic data and exit: Wolfinch.py --config <config.yml> --import_only

A lot of sample config files are available in config/ directory. Those should serve as a very good starting point.

Read More here:

Introduction-to-the-friendly-trading-bot

algorithmic-trading-with-robinhood-using-wolfinch

algorithmic-trading-with-binance-using-wolfinch

Join subreddit - wolfinch

Supported Exchanges

  • Coinbase Pro
  • Binance
  • Binance US
  • Robinhood
  • gdax [deprecated]

Disclaimer:

This project is for educational purpose only. Strategies are experimental. Use them at your own risk.

Further Enhancements:

Not based on priority.

  1. more indicators
  2. more strategies
  3. improve Decision/Model
  4. more exchanges
  5. integrate news source, sentiment analysis input for decision
  6. Any feature requests

NOTE:

Read third-party Readme for dependencies

Donate:

You can donate to appreciate the countless hours spent on the development.

  • BTC : 35bYjx9Geo6gLM41nqRnZA5KpciJEfJokD
  • ETH : 0x2598eA883719a679deEf821736fa39DF0DD9F86C
  • LTC : MRfdbKHUrSxv2zKztdVyodKwSzpQNgofr8

License

GNU General Public License v3.0 or later

See LICENSE to see the full text.

wolfinch's People

Contributors

dependabot[bot] avatar wolfinch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wolfinch's Issues

integrate main process with ui process.

integrate main process with ui process.

currently ui and main bot are two separate processes. and need to be started separately. They can be integrated so that can be started from a single entrypoint and ui config can be driven from main config.yml file.

Run UI on different port

What's the best way to define a different port for the UI to run on? I tried to edit init.py but that was unsuccessful.

Error when trying to use config file

Hi,
I tried to run python3 Wolfinch.py --config config/cbpro_example.yml. It returns the following error

Traceback (most recent call last):
  File "/home/ash/Ash/repo/wolfinch/Wolfinch.py", line 349, in <module>
    Wolfinch_init()
  File "/home/ash/Ash/repo/wolfinch/Wolfinch.py", line 69, in Wolfinch_init
    exchanges.init_exchanges(get_config())
  File "/home/ash/Ash/repo/wolfinch/exchanges/exchanges_ops.py", line 39, in init_exchanges
    for exch in WolfinchConfig['exchanges']:
KeyError: 'exchanges'

Further I tried to change 'exchanges' with 'exchange', then it returned the following error

Traceback (most recent call last):
  File "/home/ash/Ash/repo/wolfinch/Wolfinch.py", line 349, in <module>
    Wolfinch_init()
  File "/home/ash/Ash/repo/wolfinch/Wolfinch.py", line 69, in Wolfinch_init
    exchanges.init_exchanges(get_config())
  File "/home/ash/Ash/repo/wolfinch/exchanges/exchanges_ops.py", line 40, in init_exchanges
    for name, exch_cfg in exch.items():
AttributeError: 'str' object has no attribute 'items'

@joshith : Is this a bug?

Error on BUY with cbpro

Traceback (most recent call last):
File "Wolfinch.py", line 372, in
wolfinch_main()
File "Wolfinch.py", line 116, in wolfinch_main
process_market(market)
File "Wolfinch.py", line 137, in process_market
market.consume_trade_signal(signal, sl, tp)
File "/opt/wolfinch/market/market.py", line 1245, in consume_trade_signal
self._execute_market_trade(trade_req_list)
File "/opt/wolfinch/market/market.py", line 843, in _execute_market_trade
order = self._buy_order_create (trade_req)
File "/opt/wolfinch/market/market.py", line 607, in _buy_order_create
order.stop = trade_req.stop
AttributeError: 'NoneType' object has no attribute 'stop'

crash while trying to close position

Let's count the messages!
Unexpected error: (<type 'exceptions.Exception'>, Exception('Invalid open position for closing',), <traceback object at 0x7f5ee6be1d88>) exception: Invalid open position for closing

-- Goodbye! --
Traceback (most recent call last):
File "./OldMonk.py", line 315, in
oldmonk_main ()
File "./OldMonk.py", line 90, in oldmonk_main
process_market (market)
File "./OldMonk.py", line 108, in process_market
market.consume_trade_signal (signal)
File "/home/jork/OldMonk/market/market.py", line 1008, in consume_trade_signal
trade_req_list += self._generate_trade_request( signal)
File "/home/jork/OldMonk/market/market.py", line 602, in _generate_trade_request
raise Exception("Invalid open position for closing")
Exception: Invalid open position for closing

No Markets configured

Hi,
I am trying to setup Wolfinch for Binance (not US!).
I am sure I am doing something wrong, but I cannot find any info, since all Binance setup info is centered around BinanceUS.
I am getting this message when trying to start wolfinch:

[2021-03-02 13:55:12 INFO:confmgr -          load_config(192) ] reading backfill global config
[2021-03-02 13:55:12 INFO:confmgr -          load_config(196) ] reading candle_interval global config
Starting Wolfinch Trading Bot..
[2021-03-02 13:55:12 INFO:UI-OPS -           ui_mp_init(36) ] init multi-process ui
[2021-03-02 13:55:12 CRITICAL:MARKET -         market_setup(1361) ] No Markets configured. Nothing to do!
[2021-03-02 13:55:12 INFO:Wolfinch -         Wolfinch_end(82) ] Finalizing Wolfinch
[2021-03-02 13:55:12 INFO:Wolfinch -         Wolfinch_end(86) ] waiting to stop stats thread
[2021-03-02 13:55:12 INFO:UI-OPS -            ui_mp_end(47) ] finishing ui
[2021-03-02 13:55:12 INFO:UI -              ui_main(459) ] init UI server
[2021-03-02 13:55:12 INFO:Wolfinch -         Wolfinch_end(90) ] all cleanup done.

Where do I configure markets?
What should I enter if i want to trade in BTCEUR on Binance.com?
I simply took the example for BinanceUS and changed all instances of "binanceUS" to "binanceClient" -> is that right?

This is the exchanges part of config/wolfinch_binanceClient_btc_backtest_sim.yml :

exchanges:
   - 'binanceClient' :
      role: 'primary'
      config: 'config/binanceClient.yml'
      products:
         - 'BTC_EUR':
            active: true
            fund_max_liquidity : 900 #$$
            fund_max_per_buy_value : 30 #$100 max per buy
            asset_max_per_trade_size: 1000 #per sell asset size max
            asset_min_per_trade_size: .001 #Min asset size to trade with (may come from exch limits or asset l>
            stop_loss:
               enabled: true
               kind : strategy      #simple(default) | trailing | ATRXX | strategy |
               rate : 4 #-3%
            take_profit:
               enabled: true
               kind : strategy # simple (default) | strategy |
               rate: 9 # 10percent
            decision:
               model    : simple
               config   :
                  #strategy: TRABOS
                  #params: {'period': 110, 'ema': 27, 'atr': 50, 'mfi': 70, 'mfi_dir_len': 2, 'obv_dir_len': 2>
                  #params : {'period': 140, 'ema': 7, 'atr': 160, 'mfi': 125, 'mfi_dir_len': 2, 'obv_dir_len':>
                  strategy: EMA_DEV
                  params : {'ema_sell_s': 85, 'timeout_sell': 74, 'rsi': 76, 'treshold_pct_buy_l': 1.31, 'ema_>
      # products - end
      order_type    : market
      fee     :
         maker : 0.075 #make fee %
         taker : 0.075 #taker fee %
   #binanceClient - end
# exchanges - end

This is my binanceClient.yml:

##################################################
# Binance config
##################################################

exchange:
  name        : binanceClient
  products: 
    - 'BTCEUR':
       id : 'BTCEUR'
           
  ##### api secrets ######  ********* Be ** Careful *** BNC secrets are ---HOT---***
  apiKey       : 'xxxxxxxxxXXXXXXXXXXXXXXXXXX'
  apiSecret    : 'xxxxxxxxxXXXXXXXXXXXXXXXXXX'

  test_mode : false
  
  #EOF

Thanks a lot for your help. :)

Can't get market data for binanceus BTCUSD

Getting the following error trying start up a backtesting session with binanceus BTCUSD:

[2021-03-05 12:36:40 INFO:CANDLE-DB -             __init__(39) ] creating table: candle_binanceus_BTCUSD
[2021-03-05 12:36:40 CRITICAL:MARKET -          market_init(1335) ] Unable to get Market for exchange: binanceus product: {'id': 'BTCUSD', 'fund_type': 'USD', 'asset_type': 'BTCUSD', 'display_name': 'BTCUSD'} e: Traceback (most recent call last):
  File "/opt/wolfinch/market/market.py", line 1333, in market_init
    market = Market(product=product, exchange=exchange)
  File "/opt/wolfinch/market/market.py", line 355, in __init__
    self.indicator_calculators = strategy.Configure_indicators(self.exchange_name, self.product_id, ext_ind)
  File "/opt/wolfinch/strategy/config.py", line 76, in Configure_indicators
    return indicators.Configure(exchange_name, product_id, req_indicators)
  File "/opt/wolfinch/indicators/indicators_config.py", line 57, in Configure
    indicator = get_indicator_by_name (ind_name)
  File "/opt/wolfinch/indicators/indicators_config.py", line 86, in get_indicator_by_name
    return  import_indicator(name)
  File "/opt/wolfinch/indicators/indicators_config.py", line 91, in import_indicator
    mod = importlib.import_module(strat_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/wolfinch/indicators/indicators/rsi.py", line 23, in <module>
    import tulipy as ti
  File "/usr/local/lib/python3.8/dist-packages/tulipy/__init__.py", line 26, in <module>
    from . import lib
  File ".venv/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd", line 242, in init tulipy.lib
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

[2021-03-05 12:36:40 CRITICAL:MARKET -         market_setup(1361) ] No Markets configured. Nothing to do!
.```

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.