Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method does not exist (markOHLC) #112

Open
a177177 opened this issue Apr 26, 2018 · 3 comments
Open

Method does not exist (markOHLC) #112

a177177 opened this issue Apr 26, 2018 · 3 comments

Comments

@a177177
Copy link

a177177 commented Apr 26, 2018

Assuming GdaxScalperCommand.php needs a tweak but not sure where/how.

Tried this:

`$ php artisan bowhead:gdax_scalper`

Resulted in:

------------------------------------------------------------------
Set CBURL to api-public.sandbox.gdax.com before running this..
This will trade live otherwise, so be CAREFUL
PRESS ENTER TO CONTINUE
------------------------------------------------------------------

UPDATING RECENT Open, High, Low, Close data

In Macroable.php line 99:
                                                                               
  Method Bowhead\Console\Commands\GdaxScalperCommand::markOHLC does not exist  

Relevant portion of GdaxScalperCommand.php:

        echo $this->console->colorize("UPDATING RECENT Open, High, Low, Close data\n");
        $_trades = $this->coinbase->get_endpoint('trades',null,null,'ETH-USD');
        $totalsize = $trades = [];
        $total = count($_trades);
        $i = 1;
        foreach($_trades as $tr) {
            $dates = date_parse($tr['time']);
            $timeid = $dates['year'].str_pad($dates['month'],2,0,STR_PAD_LEFT).str_pad($dates['day'],2,0,STR_PAD_LEFT).str_pad($dates['hour'],2,0,STR_PAD_LEFT).str_pad($dates['minute'],2,0,STR_PAD_LEFT);

            $totalsize[$timeid] = $totalsize[$timeid] ?? 0; // init if not present
            $totalsize[$timeid] += $tr['size'] ?? 0;        // otherwise increment
            $ticker = [];
            $ticker['timeid'] = $timeid;
            $ticker[7] = $tr['price'];
            $ticker[8] = $totalsize[$timeid] ?? 0;
            $this->markOHLC($ticker, 1, $this->instrument);
            $this->console->progressBar($i, $total);
            $i++;
        }

I'm new to coding so it's possible I'm missing something stupidly obvious here...

@deakzsolt
Copy link

markOHLC was removed and it was for feeding the DB with data. For testing and playing with this comment out this line and you will see the data flowing in. This is not a long term solution.

@a177177
Copy link
Author

a177177 commented Apr 27, 2018

Tried commenting out the markOHLC lines and got the result:

------------------------------------------------------------------
Set CBURL to api-public.sandbox.gdax.com before running this..
This will trade live otherwise, so be CAREFUL
PRESS ENTER TO CONTINUE
------------------------------------------------------------------

UPDATING RECENT Open, High, Low, Close data

Updating...

It keeps giving me "Updating..." but where is it doing so? I checked bowhead_OHLC and it shows empty set. Went ahead and uncommented markOHLC lines and added in:

    public function markOHLC($ticker)
    {
        $last_price = $ticker[7];
        $volume = $ticker[8];
        $timeid = date('YmdHi'); // 201705301522 unique for date
        $ins = \DB::insert("
            INSERT INTO bowhead_ohlc 
            (`instrument`, `timeid`, `open`, `high`, `low`, `close`, `volume`)
            VALUES
            ('ETH-USD', $timeid, $last_price, $last_price, $last_price, $last_price, $volume)
            ON DUPLICATE KEY UPDATE 
            `high`   = CASE WHEN `high` < VALUES(`high`) THEN VALUES(`high`) ELSE `high` END,
            `low`    = CASE WHEN `low` > VALUES(`low`) THEN VALUES(`low`) ELSE `low` END,
            `volume` = VALUES(`volume`),
            `close`  = VALUES(`close`)
        ");
        return true;
    }

and this populated bowhead_OHLC but the data (open, high, low, close, volume) was being repeated and not updated. Not sure how to tweak the code for markOHLC to get the proper data feed. So close!

@deakzsolt
Copy link

I have started to fix the issues and upgrade this in my own fork. There is a README file so check there where did I stop. Please note this is under progress project and there might be a lot of errors. DO NOT USE REAL API just demo for testing until all is resolved.
Here is the forked version https://github.com/deakzsolt/bowhead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants