joeldg / bowhead Goto Github PK
View Code? Open in Web Editor NEWPHP trading bot framework
License: Apache License 2.0
PHP trading bot framework
License: Apache License 2.0
It would be awesome to be able to set a desired price range either by percent or by value that the bot checks the books and makes sure your order is at the top to be bought or at the bottom to be sold within one or two people. Automatically adjusting the price to make the best possible sale. I'm still waiting on my api key for coin base to test this bot out. I can't wait to get started playing with the code. Thanks for all the hard work you have done. Much appreciated.
edited the .env file to add
OANDA_TOKEN=XXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXX
and
OANDA_ACCOUNT=XXX-XXX-XXXXXXX-XXX
but still get this error
INFO gave up: oanda entered FATAL state, too many start retries too quickly
docker run --name=bowhead -p 127.0.0.1:8080:8080 bowhead
also this is for fx-trade practice account that I am using
the price data is coming in only for an hour or so before it cuts off. Can't start any strategy because:
"YOU HAVE 95 PERIODS OF VALID PRICE DATA OUT OF 168. Please ensure price sync is running and wait for additional data to be logged before trying again. Additionally you could use a smaller time period if available."
it stops around 100 periods all the time...
I'm running the "screen php artisan bowhead:websocket_bitfinex" command
we could create a UI like gekko has
https://github.com/askmike/gekko
I think that would make it easier to use and good for backtesting as well
I seem to be having some issues with the pecl/trader on Ubuntu running on EC2.
When I get to the point:
php artisan bowhead:example_usage
I am greeted with:
See the tutorial:
https://medium.com/@joeldg/an-advanced-tutorial-a-new-crypto-currency-trading-bot-boilerplate-framework-e777733607a
You are missing the required Trader extension http://php.net/manual/en/book.trader.php
TO INSTALL:
curl -O http://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
sudo pecl install trader
Getting to this:
sudo pecl install trader
Gives me the dreaded XML Extension not found error, but going SUDO SU and then running this command first:
sed -i "$ s|\-n||g" /usr/bin/pecl
and then running
sudo pecl install trader
again gives me:
ubuntu@ip-:~/bowhead$ sudo su
root@ip-:/home/ubuntu/bowhead# sed -i "$ s|\-n||g" /usr/bin/pecl
root@ip-:/home/ubuntu/bowhead# sudo pecl install trader
pecl/trader is already installed and is the same as the released version 0.4.0
install failed
I appear to be stuck, I am by no means an Ubuntu expert so any help here would be greatly appreciated.
Hi,
This might not be an issue for those that can get their accounts sorted at GDAX but after waiting 2 weeks without any answer to multiple support tickets I am wondering if its possible top get everything (most things) working without GDAX support. I have Bowhead running with the example in the medium blog (just the simple bowhead:example_strategy) but I get the following error with the bowhead:example_forex_strategy
[ErrorException]
Undefined index: high
The database is collecting data forex data (fx_stream) and bitfinex websocket is running
Thanks
Running the docker container out of the box and example_usage script results in the following error (Let me know if this is a misconfiguration in .env or maybe I missed a step setting things up).
root@2784fbc4a7b5:/var/www/bowhead# php artisan bowhead:example_usage -vvv
[ErrorException]
Illegal string offset 'symbol'
Exception trace:
() at /var/www/bowhead/app/Util/OneBroker.php:71
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at /var/www/bowhead/app/Util/OneBroker.php:71
Bowhead\Util\OneBroker->__construct() at /var/www/bowhead/app/Console/Commands/ExampleUsageCommand.php:68
Bowhead\Console\Commands\ExampleUsageCommand->handle() at n/a:n/a
call_user_func_array() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87
Illuminate\Container\BoundMethod::callBoundMethod() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31
Illuminate\Container\BoundMethod::call() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/Container.php:539
Illuminate\Container\Container->call() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Console/Command.php:182
Illuminate\Console\Command->execute() at /var/www/bowhead/vendor/symfony/console/Command/Command.php:264
Symfony\Component\Console\Command\Command->run() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Console/Command.php:167
Illuminate\Console\Command->run() at /var/www/bowhead/vendor/symfony/console/Application.php:888
Symfony\Component\Console\Application->doRunCommand() at /var/www/bowhead/vendor/symfony/console/Application.php:224
Symfony\Component\Console\Application->doRun() at /var/www/bowhead/vendor/symfony/console/Application.php:125
Symfony\Component\Console\Application->run() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122
Illuminate\Foundation\Console\Kernel->handle() at /var/www/bowhead/artisan:35
I believe that this...
$this->markOHLC(json_encode($ticker));
...should be...
$this->markOHLC($ticker);
Happy to submit a pull request if required.
White going through the tutorial on ubuntu server trying to do the command screen python streaming.py I originally got the error import request not available. after installing python reqest, no clue how I figured that one out, I got the error dotenv not included. did the same as before and now i'm getting the error listed above in the title section. I used pip install dotenv. Uninstalled that one and then used pip install python-dotenv. still no luck. tried django python dotenv. still no luck. I must be doing something wrong. Please help.
Hi! Please add support for our exchange, CoinFalcon. API is located here: https://docs.coinfalcon.com/
With both the docker and normal install the example usage gives the following error:
[ErrorException]
A non well formed numeric value encountered
When I comment out the functions for Coinbase the scripts completes without error so I know there is something wrong with the Coinbase function. I just can't figure out where the bug is.
bowhead/app/Traits/Strategies.php
Line 109 in ee67a6e
bowhead/app/Traits/Strategies.php
Line 110 in ee67a6e
bowhead/app/Traits/Strategies.php
Line 111 in ee67a6e
Line 111 uses $sma as array input, but the array is overwritten on Line 110 to a single value, maybe I could oversee something, but I think its a small coding mistake.
Also saw it on the function ma_maker.
It appears there might be some code to control bowhead through a webserver versus the command line. Does anyone know if this is the case? If not, why is it necessary to install Apache 2.4 - which I believe is for allowing us to create a localhost. Solely to enable hosting a database via MySQL? But then at what point in the install was MySQL configured to receive information from localhost.
I realize these are pretty convoluted / novice questions. Im much more familiar with app development and am trying to gain a fuller understanding of how Apache, MySQL , the Command Line and PHP are work in together to allow bowhead to function. Not as familar with web-based applications. ANY HELP, would be appreciated - thanks.
hi,
It's working fine with usd price (ex 1btc = 9800$)
but with decimal value like 1 XLM = 0.00000855 btc
looks like it doesnt handle decimal value so the ema (or macd) value is always 0 😞
print_r($data);
//output :
Array
(
[0] => 7.08E-6
[1] => 7.07E-6
[2] => 7.04E-6
[3] => 7.03E-6
[4] => 6.99E-6
[5] => 7.01E-6
[6] => 6.95E-6
[7] => 6.99E-6
[8] => 7.05E-6
// ...
)
$emaArray = trader_ema($data, $period);
print_r($emaArray);
Array
(
[20] => 0
[21] => 0
[22] => 0
[23] => 0
[24] => 0
[25] => 0
[26] => 0
[27] => 0
[28] => 0
// ...
)
Hi,
Great initiative for your repo
I would recommend to implement https://www.coinigy.com/ because this site can manage multiple exchange and provide an API
;)
Hi,
When I run php artisan bowhead:example_strategy
I get the following error:
YOU HAVE 115 PERIODS OF VALID PRICE DATA OUT OF 168. Please ensure price sync is running and wait for additional data to be logged before trying again. Additionally you could use a smaller time period if available.
The value is stuck at 115 even after waiting several minutes.
What is wrong?
I've been killing myself trying to figure this out on my own, but it's just not happening for me. I'm running the most recent version from Github in Docker on Ubuntu, and I get the following error when example_strategy tries to call Whaleclub when cci/cmo/mfi is -/+1. Here's the output I get (same error with -vvv):
Signals for BTC/USD:cci:-1 cmo:0 mfi:-1 overbought underbought
Signals for BTC/USD:cci:-1 cmo:0 mfi:-1 overbought underbought
Signals for BTC/USD:cci:-1 cmo:-1 mfi:-1 overbought underboughtArray
(
[error] => Array
(
[code] => 400
[name] => Validation Error
[message] => Market is missing or invalid.
)
)
I suspect something is wrong in Util\Whaleclub.php, but I would assume that everyone else would be seeing this error if that was the case... My WC demo key is valid, and example_usage returns my WC account info when I run it. Any thoughts?
Streaming.py still errors out because any new accounts on Oanda will be a V20 account and uses the V20 api. the code you are using calls the v1 api. Maybe another variable can be added to adjust the api endpoints based on whether the user has a V20 account or not.
Caught exception when connecting to stream
HTTPSConnectionPool(host='stream-fxpractice.oanda.com', port=443): Max retries exceeded with url: /v1/prices?instruments=USD_JPY%2CEUR_USD%2CAUD_USD%2CEUR_GBP%2CUSD_CAD%2CUSD_CHF%2CUSD_MXN%2CUSD_TRY%2CUSD_CNH%2CNZD_USD&accountId=101-001-6251772-001 (Caused by <class 'httplib.BadStatusLine'>: '')
Traceback (most recent call last):
File "streaming.py", line 90, in
main()
File "streaming.py", line 86, in main
demo(displayHeartbeat)
File "streaming.py", line 57, in demo
if response.status_code != 200:
AttributeError: 'NoneType' object has no attribute 'status_code'
root@eaaed65955a0:/var/www/bowhead# python streaming.py
{
"code" : 1,
"message" : "Invalid or malformed argument: accountId",
"moreInfo" : "http://developer.oanda.com/docs/v1/troubleshooting/#errors"
}
For those of us affected, are there any alternatives for obtaining altcoin streaming data?
This is the announcement Bitfinex made that I'm referring to:
"Update: U.S. Individual Users October 16, 2017
This message is further to our announcement of August 11, 2017, with respect to terminating our business with U.S. individual customers. As indicated in the announcement, we are terminating trading, deposits, and withdrawal functionality for U.S. individual customers by no later than November 9, 2017. U.S. customers are already barred from receiving financing from other users on Bitfinex’s peer-to-peer financing platform. This restriction will remain and, in addition, U.S. individual customers will no longer be able to provide financing on Bitfinex effective November 9, 2017."
Would be great if there could be a common Codestyle that all looks the same, and phpstorm autostyle will not mess whole files which are commited later.
Oanda is no longer allowing me to add v1 accounts when I signed up today.
Please add v20 api support.
Always have the problem whn trying to use on of the CandleStrategies that in the CandleMap Trait, on line 192
foreach($candle_data['current'] as $key => $data) {
The index current seems not to exist, couldn't find the cause yet.
There's a problem when trying to build the array in the candle_value() method.
In https://github.com/joeldg/bowhead/blob/master/app/Traits/CandleMap.php#L211
The hanginman candle is in the counter_purpose['bear'] array. The code mentioned above will try to get the hanginman key in the price_continuation['bull'] array which will lead to an exception.
I got these:
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2002] No such file or directory (SQL: select *, unix_timestamp(ctime) as buckettime from bowhead_ohlc_ 1m
where instrument
= BTC/USD order by timeid
desc limit 168)
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
Traceback (most recent call last):
File "streaming.py", line 90, in
main()
File "streaming.py", line 86, in main
demo(displayHeartbeat)
File "streaming.py", line 56, in demo
response = connect_to_stream()
File "streaming.py", line 28, in connect_to_stream
dotenv.load()
AttributeError: 'module' object has no attribute 'load'
Any idea of how to fix this? I have attempted on my Mac and on an Ubuntu VPS
It would make more sence if these two classes would be static classes and all function static functions as there is no usage of class members.
What is your plan for supporting bittrex exchange ?
Has anyone tried running this project as a Docker image in Raspian on a Raspberry Pi? I've been toying around with it for a few days, and have hit a brick wall... I can finally get the Docker image to build and run, but get the following error when trying to run any commands:
root@f905f4af6e38:/var/www/bowhead# php artisan bowhead:example_strategy
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/trader.so' - /usr/lib/php/20151012/trader.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: require(/var/www/bowhead/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/bowhead/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/var/www/bowhead/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/bowhead/bootstrap/autoload.php on line 17
root@f905f4af6e38:/var/www/bowhead#
I have to assume this is related to using php7.0-fpm in the Dockerconfig file instead of php7.1-fpm (which does not appear to be available on Raspbian right now). Here is a quick list of the changes I had to make in order to get this far:
Must use portainer/portainer:arm to get the RaspberryPi build of Portainer
If you get an error that says: cgroups: memory cgroup not supported on this system
do this: add "cgroup_memory=1" to /boot/cmdline.txt and then reboot
Edits to bowhead/docker/Dockerfile:
change FROM line to "FROM armv7/armhf-ubuntu"
in first RUN block, change "php7.1-fpm" to "php7.0-fpm"
Edits to bowhead/docker/resources/config_bowhead.sh:
change "service php7.1-fpm start" to "service php7.0-fpm start"
Rename "bowhead/docker/resources/etc/php/7.1" to "bowhead/docker/resources/etc/php/7.0"
Hi,
First of all, I'm a not an expert in trading, just trying this library to learn some basic trading concepts.
I'm trying the ExampleForexStrategyCommand.php with a 5m period on eth/usd pair.
As you do in the article, I went on WhaleClub and draw the sma6 and sma40 for the 5minutes period, then run the app and check along with the chart.
My problem is that is doesn't seem to match.
The app detected only a downcross at 15:30.
I understand the candles can be a little bit shifted as the data from bitfinex is not time stamped but can it be the problem ?
Hi,
I opened up an Acc at Oanda and got the api key. But what value is supposed to be put in at OANDA_ACCOUNT=?
So I am at the part where you need to type in this command "php artisan bowhead:example_usage"
There are two different scenarios with this command:
- It gives me the error "New state of 'nil' is invalid". It then Exits from the ssh. Also it will sometimes ( not always) completely wipe my .env file and reset it back to default where my keys are not there.
- It gives me:
"[RuntimeException]
OneBroker API returned an error - 201: Invalid token. You are not logged in." this error does not exit from ssh but it also sometimes erases all my .env file. I rechecked the token multiple times and it's good.
I have tried example forex strategy it give me this:
"PRESS 'q' TO QUIT AND CLOSE ALL POSITIONS
[ErrorException]
Undefined Index: high"
Also example signals gives this:
"PRESS 'q' TO QUIT AND CLOSE ALL POSITIONS
[ErrorException]
Undefined Index: close"
The only one that worked (I think) was example strategy which kept printing a line, ex:
"Signals for BTC/USD:cci:-1 cmo:-1 mfi:0 overbought underbought" every couple seconds.
If anyone has an idea how to fix this that would be great, thanks
In the getRecentData method we have
/** Check for missing periods **/
if ($periodSize == '1m') {
$variance = (int)75;
}
/// ...
if ((int)$periodcheck > (int)$variance) {
echo 'YOU HAVE '.$validperiods.' PERIODS OF VALID PRICE DATA OUT OF '.$limit.'. '
If i echo $periodcheck :
periodcheck 70
periodcheck 67
periodcheck 30
periodcheck 69
periodcheck 88 <==== fail
YOU HAVE 23 PERIODS OF VALID PRICE DATA OUT OF 55. Please ensure price sync is running and wait for additional data to be logged before trying again. Additionally you could use a smaller time period if available.
So bitfinex may lag sometime, and make the bot stop
I Will try bittrex maybe 😢
Im wondering if the startegies are really working, ive running since 2 days on a 1minute base for 10 Different coin-pairs and never had more than 2 strategies indicate a buy or a sell at the same time. Im no financal expert so I don't really know if it is normal or not, maybe some of you have other experiences and an idea why this is the case.
Hi,
Following article 1 and checking code at the same time, it says :
Average directional movement index (ADX) is a trend indicator that typically returns a number from 0–100, under 20 it indicates a weak trend, over 50 it indicates a strong trend. Bowhead returns a -1 for under 20 and a 1 for over 50;
But in :
https://github.com/joeldg/bowhead/blob/master/app/Util/Indicators.php#L783
It looks like it is inverted, is it intended ?
php artisan bowhead:websocket_bitfinex
gives me:
[Illuminate\Database\QueryException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) [...]
ok, so how do I get around this one. I have installed bowhead on my headless ubuntu server. I'm trying to set up the sample config and I keep getting this error.
OneBroker API returned an error - 201: Invalid token. You are not logged in.
I am logged in from another computer. I'm not sure how to go about logging in from the headless server. Any assistance would be helpfully and much appreciated.
Hi,
looks like it can't connect to bitfinex, any idea ? Thanks
root@a4ac7326ad35:/var/www/bowhead# php artisan bowhead:websocket_bitfinex
BID error!
BID error!
ASK error!
ASK error!
ASK error!
ASK error!
ASK error!
BID error!
BID error!
BID error!
BID error!
BID error!
Anybody can give me suggestion about this issues:
[root@instance-6 public_html]# php artisan bowhead:websocket_bitfinex -vvv
[Predis\Connection\ConnectionException (111)]
Connection refused [tcp://127.0.0.1:6379]
Exception trace:
() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/AbstractConnection.php:155
Predis\Connection\AbstractConnection->onConnectionError() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/StreamConnection.php:128
Predis\Connection\StreamConnection->createStreamSocket() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/StreamConnection.php:178
Predis\Connection\StreamConnection->tcpStreamInitializer() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/StreamConnection.php:100
Predis\Connection\StreamConnection->createResource() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/AbstractConnection.php:81
Predis\Connection\AbstractConnection->connect() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/StreamConnection.php:258
Predis\Connection\StreamConnection->connect() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/AbstractConnection.php:180
Predis\Connection\AbstractConnection->getResource() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/StreamConnection.php:288
Predis\Connection\StreamConnection->write() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/StreamConnection.php:394
Predis\Connection\StreamConnection->writeRequest() at /home/mytrader.com/public_html/vendor/predis/predis/src/Connection/AbstractConnection.php:110
Predis\Connection\AbstractConnection->executeCommand() at /home/mytrader.com/public_html/vendor/predis/predis/src/Client.php:331
Predis\Client->executeCommand() at /home/mytrader.com/public_html/vendor/predis/predis/src/Client.php:314
Predis\Client->__call() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php:72
Illuminate\Redis\Connections\Connection->command() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php:84
Illuminate\Redis\Connections\Connection->__call() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:93
Illuminate\Cache\RedisStore->put() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php:175
Illuminate\Cache\Repository->put() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php:305
Illuminate\Cache\CacheManager->__call() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:221
Illuminate\Support\Facades\Facade::__callStatic() at /home/mytrader.com/public_html/app/Console/Commands/BitfinexWebsocketCommand.php:199
Bowhead\Console\Commands\BitfinexWebsocketCommand->Bowhead\Console\Commands{closure}() at /home/mytrader.com/public_html/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:70
Ratchet\Client\WebSocket->emit() at /home/mytrader.com/public_html/vendor/ratchet/pawl/src/WebSocket.php:71
Ratchet\Client\WebSocket->Ratchet\Client{closure}() at /home/mytrader.com/public_html/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php:104
Ratchet\RFC6455\Messaging\MessageBuffer->processData() at /home/mytrader.com/public_html/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php:60
Ratchet\RFC6455\Messaging\MessageBuffer->onData() at /home/mytrader.com/public_html/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:70
Evenement\EventEmitter->emit() at /home/mytrader.com/public_html/vendor/react/stream/src/Stream.php:173
React\Stream\Stream->handleData() at n/a:n/a
call_user_func() at /home/mytrader.com/public_html/vendor/react/event-loop/src/StreamSelectLoop.php:236
React\EventLoop\StreamSelectLoop->waitForStreamActivity() at /home/mytrader.com/public_html/vendor/react/event-loop/src/StreamSelectLoop.php:205
React\EventLoop\StreamSelectLoop->run() at /home/mytrader.com/public_html/app/Console/Commands/BitfinexWebsocketCommand.php:375
Bowhead\Console\Commands\BitfinexWebsocketCommand->handle() at n/a:n/a
call_user_func_array() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
Illuminate\Container\BoundMethod::Illuminate\Container{closure}() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87
Illuminate\Container\BoundMethod::callBoundMethod() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31
Illuminate\Container\BoundMethod::call() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php:539
Illuminate\Container\Container->call() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php:182
Illuminate\Console\Command->execute() at /home/mytrader.com/public_html/vendor/symfony/console/Command/Command.php:264
Symfony\Component\Console\Command\Command->run() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php:167
Illuminate\Console\Command->run() at /home/mytrader.com/public_html/vendor/symfony/console/Application.php:888
Symfony\Component\Console\Application->doRunCommand() at /home/mytrader.com/public_html/vendor/symfony/console/Application.php:224
Symfony\Component\Console\Application->doRun() at /home/mytrader.com/public_html/vendor/symfony/console/Application.php:125
Symfony\Component\Console\Application->run() at /home/mytrader.com/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122
Illuminate\Foundation\Console\Kernel->handle() at /home/mytrader.com/public_html/artisan:35
Not sure if this is an actual problem or not (since not sure how the data is processed exactly when running strategies) but I've noticed that the 30m table data is not recorded close to 30m increments it seems a bit off ..
http://storage7.static.itmages.com/i/17/0807/h_1502079128_1323211_07ba2568fa.png
You can see that the times are a bit off ..
01:25:00
01:55:03
02:00:02
02:15:03
So seems to be coming in sometimes 5 minute increments, 15 minute increments, it kind of seems all over the place. Shouldn't the 30m table only contain entries roughly every 30 minutes?
Hello,
First, thank you... this is a great resource for me to learn from!
I think I am missing something... but where are your models? Can't seem to find even "Bowhead\User"... or are you not storing any data into a database?
Thanks!
cannot locate .env for editing
Hello :)
When i run : php artisan bowhead:oanda_stream
The bowhead_ohlc_tick table is feeded by magic, where does it come from ?
i've seen there is in OandaStreamCommand.php
$pipeB = fopen("quotes",'r');
$line = fgets($pipeB, 2048);
$this->markOHLC($line);
but how the quotes file is feeded ? It's a 0 octet files :(
Thanks for the help
After booting bowhead and running the gdax scalper (sandbox api) it will run normally for some time and then the program will crash with the exception: array_pop() expects parameter 1 to be array, null given
Subsequently restarting the script causes it to instantly crash again w/ the same exception. The exception trace is:
() at /var/www/bowhead/app/Util/Indicators.php:360
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a
array_pop() at /var/www/bowhead/app/Util/Indicators.php:360
Bowhead\Util\Indicators->stoch() at /var/www/bowhead/app/Traits/Strategies.php:160
Bowhead\Console\Commands\GdaxScalperCommand->bowhead_sar_stoch() at /var/www/bowhead/app/Console/Commands/GdaxScalperCommand.php:175
Bowhead\Console\Commands\GdaxScalperCommand->fire() at n/a:n/a
call_user_func_array() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
Illuminate\Container\BoundMethod::Illuminate\Container{closure}() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87
Illuminate\Container\BoundMethod::callBoundMethod() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31
Illuminate\Container\BoundMethod::call() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/Container.php:539
Illuminate\Container\Container->call() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Console/Command.php:182
Illuminate\Console\Command->execute() at /var/www/bowhead/vendor/symfony/console/Command/Command.php:240
Symfony\Component\Console\Command\Command->run() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Console/Command.php:167
Illuminate\Console\Command->run() at /var/www/bowhead/vendor/symfony/console/Application.php:858
Symfony\Component\Console\Application->doRunCommand() at /var/www/bowhead/vendor/symfony/console/Application.php:216
Symfony\Component\Console\Application->doRun() at /var/www/bowhead/vendor/symfony/console/Application.php:122
Symfony\Component\Console\Application->run() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122
Illuminate\Foundation\Console\Kernel->handle() at /var/www/bowhead/artisan:35
Thus, it appears that the call chain generating the exception arises from bowhead_sar_stoch(), specifically at the level when the stoch() function within Util/Indicators is called (pasted below).
public function stoch($pair='BTC/USD', $data=null, $matype1=TRADER_MA_TYPE_SMA, $matype2=TRADER_MA_TYPE_SMA)
{
if (empty($data)) {
$data = $this->getRecentData($pair);
}
if (empty($data['high'])) {
return 0;
}
#$prev_close = $data['close'][count($data['close']) - 2]; // prior close
#$current = $data['close'][count($data['close']) - 1]; // we assume this is current
#high,low,close, fastk_period, slowk_period, slowk_matype, slowd_period, slowd_matype
$stoch = trader_stoch($data['high'], $data['low'], $data['close'], 13, 3, $matype1, 3, $matype2);
$slowk = $stoch[0];
$slowd = $stoch[1];
$slowk = array_pop($slowk); #$slowk[count($slowk) - 1];
The bolded line is what's causing the exception. Not really sure how you'd go about debugging this / figuring out the problem.
I cloned your repo and run create_docker, but MySQL won't start.
On debian machines its almost impossible to catch up to 7.1 without changing to some special packages, just upgraded my php for the Project from 5.6 to 7.0 on debian8 which was already quite a mess. Would be amazing if 7.0 could be supported and stay in support, should not make a big coding difference anyways. (PHP Storm offers a nice Setting for the Language level, so you can't mistakly use Syntax from above).
php artisan bowhead:example_usage
gives me:
[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Bowhead\Strategy\Whaleclub' not found
Hi,
Shouldn't this line
bowhead/app/Traits/CandleStrategies.php
Line 24 in ee67a6e
I have gotten to the point where I can stream in data from GDAX and Forex... but when I attempt to stream in data from Bitfinex and run "php artisan bowhead:websocket_bitfinex" nothing displays and then I get "Bid Error!". I want to debug this issue on my own, but am unfamiliar on how to link running the commands in the Command Line and my IDE (PHPStorm). Does anyone here know how I might be able to run bowhead from within PHPStorm / if its possible, so that I can toggle line by line?
Hi Joel,
Firsty, let me thank you for doing this project. You are doing fantastic job and it's a great source of information. I was lately looking into strategies and I see that you are running all your strategies with 1m charts, even those intended to be run on longer charts.
However, I was looking into 5m, 15m and 30m strategies. For example strategy bowhead_double_volatility
is using Trader::rsi($data['close'], 11);
which will use 11 timePeriods from 1m charts. Therefore it will calculate such indicator from last 11 minutes. That seems reasonable for me.
You mention in your blog, that this strategy is expected to be run in 30m periods. I assume that $data provided to strategy should be then 30m charts rather than 1m charts and so Trader::rsi($data['close'], 11);
would calculate signal from last 11*30= 330minutes charts. Is that assumption correct? Or should I change this timePeriod to lower in case I want to use 30m charts?
Thank you for reply.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.