Finance::GDAX::API::Report - Generate GDAX Reports
use Finance::GDAX::API::Report; $report = Finance::GDAX::API::Report->new( start_date => '2017-06-01T00:00:00.000Z', end_date => '2017-06-15T00:00:00.000Z', type => 'fills'); $report->product_id('BTC-USD'); $result = $report->create; $report_id = $$result{id}; # After you create the report, you check if it's generated yet $report = Finance::GDAX::API::Report->new; $result = $report->get($report_id); if ($$result{status} eq 'ready') { `wget $$result{file_url}`; }
Generating reports at GDAX is a 2-step process. First you must tell GDAX to create the report, then you must check to see if the report is ready for download at a URL. You can also specify and email address to have it mailed.
Reports can be "fills" or "account". If fills, then a product_id is needed. If account then an account_id is needed.
The format can be "pdf" or "csv" and defaults to "pdf".
type
Report type, either "fills" or "account". This must be set before calling the "create" method.
start_date
Start of datetime range of report in the format "2014-11-01T00:00:00.000Z" (required for create)
end_date
End of datetime range of report in the format "2014-11-01T00:00:00.000Z" (required for create)
product_id
The product ID, eg 'BTC-USD'. Required for fills type.
account_id
The account ID. Required for account type.
format
Output format of report, either "pdf" or "csv" (default "pdf")
email
Email address to send the report to (optional)
report_id
This is used for the "get" method only, and can also be passed as a parameter to the "get" method.
It is the report id as returned by the "create" method.
create
Creates the GDAX report based upon the attributes set and returns a hash result as documented in the API:
{ "id": "0428b97b-bec1-429e-a94c-59232926778d", "type": "fills", "status": "pending", "created_at": "2015-01-06T10:34:47.000Z", "completed_at": undefined, "expires_at": "2015-01-13T10:35:47.000Z", "file_url": undefined, "params": { "start_date": "2014-11-01T00:00:00.000Z", "end_date": "2014-11-30T23:59:59.000Z" } }
get
Returns a hash representing the status of the report created with the "create" method.
The parameter $report_id is optional - if it is passed to the method, it overrides the object's report_id attribute.
The result when first creating the report might look like this:
{ "id": "0428b97b-bec1-429e-a94c-59232926778d", "type": "fills", "status": "creating", "created_at": "2015-01-06T10:34:47.000Z", "completed_at": undefined, "expires_at": "2015-01-13T10:35:47.000Z", "file_url": undefined, "params": { "start_date": "2014-11-01T00:00:00.000Z", "end_date": "2014-11-30T23:59:59.000Z" } }
While the result when GDAX finishes generating the report might look like this:
{ "id": "0428b97b-bec1-429e-a94c-59232926778d", "type": "fills", "status": "ready", "created_at": "2015-01-06T10:34:47.000Z", "completed_at": "2015-01-06T10:35:47.000Z", "expires_at": "2015-01-13T10:35:47.000Z", "file_url": "https://example.com/0428b97b.../fills.pdf", "params": { "start_date": "2014-11-01T00:00:00.000Z", "end_date": "2014-11-30T23:59:59.000Z" } }
Mark Rushing <mark@orbislumen.net>
This software is copyright (c) 2017 by Home Grown Systems, SPC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Finance::GDAX::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::GDAX::API
CPAN shell
perl -MCPAN -e shell install Finance::GDAX::API
For more information on module installation, please visit the detailed CPAN module installation guide.