Comments (6)
I had a similar bug. I don't know how the runner is parsing the strategy argument, so I just cd'ed into the strategies folder and ran gryphon-exec strategy mystrat
(no .py at the end). Should work.
from gryphon.
The code that loads strategies is right here:
gryphon/gryphon/execution/live_runner.py
Lines 146 to 161 in 8cd2f43
Looking at it now, yes it does expect .pyx and not .py. and because of the way importlib works, it will work if you don't give a filetype suffix. So:
gryphon-exec strategy strats/mystrat.py -> FAIL
gryphon-exec strategy strats/mystrat -> SUCCESS
gryphon-exec strategy strats/mystrat.pyx -> SUCCESS
Seems to me the simplest fix here would be to truncate both .py and .pyx suffixes from any strategy file and then let importlib succeed/fail on it's own. That will let users use .py or .pyx on their own whim. On the other hand, maybe we want to enforce one or the other filetype so that users get the biggest performance benefit possible from cython.
What do you guys think? I'm open to options.
from gryphon.
importlib already has a way to import a module from a filepath.
So I wouldn't want to add any logic on top of that.
Meaning :
- argument is a file path, load the file path with importlib.
- argument is a module name, load the module name with importlib.
However it can be quite troublesome to support between different python versions (see https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path)
So I guess this might depend on gryphon's expected minimum python version ?
If backward compatibility is needed, I made a while ago for other projects a backport of the python3 import logic into python2 : https://github.com/asmodehn/filefinder2, but that might add extra complexity that is not really needed, since python2 is dying already.
from gryphon.
Definitely looks like there's considerations with importlib as we move towards python3, but I think we can consider that as part of the python3 project.
I think the initial bug you identified, that loading strategies from .py files is broken, is big enough to fix immediately, and the fix is pretty simple: we just add one more 'replace' call on line 152 to strip '.py' suffixes as well as '.pyx'.
Do you want to make that edit and create a PR? You identified the bug so feels appropriate. If not I can do it too, just thought I'd offer!
from gryphon.
from gryphon.
I believe the fix left this part aside :
https://github.com/garethdmm/gryphon/blob/master/gryphon/execution/lib/config_helper.py#L96
Which means the configuration file should be named with "strat_name.py.conf" currently, and that is probably not intended
from gryphon.
Related Issues (20)
- Bitstamp : subaccount API invalid signature HOT 3
- The homepage readme "gryphon-exe" is a typo? HOT 2
- exchange.market_order requires a price ? HOT 4
- Document sim_exchange HOT 1
- Strategy: Auditing cancels orders ? HOT 1
- Running [strat_name].py leads to .config file not being found. Original fix did not resolve this HOT 2
- Looking for feedback: Strategies and Strategy Ledgers are not intuitive to users HOT 1
- Add support for BitMex exchange. HOT 1
- Keeping track of dependencies HOT 2
- Running a strategy from a Jupyter Notebook HOT 1
- 'module' object has no attribute 'Money' HOT 4
- Setting up Data Service HOWTO HOT 1
- AttributeError: type object 'IOLoop' has no attribute 'initialized' HOT 2
- Slack invite link is down HOT 6
- AttributeError: 'NoneType' object has no attribute '_instantiate_plugins' HOT 2
- How to use ohlc bar data ? if I want TA indicator in my strategy? HOT 1
- What was the main idea to synchronize exchange rate of fiat-currencies?
- Migrate database cannot import name escape_sequence
- ERROR:gryphon.execution.live_runner:[UnmappedInstanceError] Class '__builtin__.NoneType' is not mapped
- ImportError: cannot import name ESDIRK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gryphon.