mockingmagician / coinbase-pro-sdk Goto Github PK
View Code? Open in Web Editor NEWCoinbase Pro API SDK - Communicate easily with the Coinbase Pro API in PHP
Home Page: https://mockingmagician.github.io/coinbase-pro-sdk/
License: MIT License
Coinbase Pro API SDK - Communicate easily with the Coinbase Pro API in PHP
Home Page: https://mockingmagician.github.io/coinbase-pro-sdk/
License: MIT License
what is endpoint in the api? and where can i find it?
$api = CoinbaseFacade::createDefaultCoinbaseApi(
'',
'3d39911**',
'ktDPCinK**',
'd2lkk**');
$products = $api->products()->getProducts();
echo "<pre>";
var_dump($api);
Attempting to use this call:
$api->currencies()->getCurrencies();
Return this error and there are no expected parameters to be passed.
Argument 2 passed to MockingMagician\CoinbaseProSdk\Functional\DTO\CurrencyDetailsData::__construct() must be of the type string, null given, called in /Users/xxxxx/Sites/localhost/crypto/crypto/vendor/mocking-magician/coinbase-pro-sdk/src/Functional/DTO/CurrencyDetailsData.php on line 154
On a side note I am looking to convert from BTC to DAI and vica versa - but I can't seem to figure that out in this package. Thoughts?
Hi,
Argument 11 passed to MockingMagician\CoinbaseProSdk\Functional\DTO\OrderData::__construct() must be of the type bool, null given, called in...
For some reason, the Coinbase pro API is returning this null field, and the library expects a bool value.
This is the field: post_only It must be able to be bool? null
Thank you for the bundle.
Thanks for the library, it was just what I needed.
I am using this with Laravel currently and when I get the API response I can dd($response); and see the array data from Coinbase. Is it possible to convert this easily to JSON?
I have tried to json_encode($response) and it returns ['','','','',''] blank brackets. I did some research and it found this reponse:
"This means that AccountData does not implement JsonSerializable and the members seen there are all private so they are not exposed when it gets converted to json. If you wrote those classes you should probably change then and if not then consult the documentation of whoever wrote them on how to get those fields exposed so you can write some custom code to covert them to an array"
This is just a simple $response = $api->accounts()->list(); by the way.
What do you think?
Hey! Thanks for this awesome API Wrapper, so far it has been very helpful in the development process.
Now the problem: I'm trying to understand how to read the order book from the API.
I've found in the docs the following
$res = $this->api->products()->getProductOrderBook('BTC-USD')->getAsks();
but then it doesn't return an array nor an iterable object with the ask's order book. instead it returns:
array(1) {
[0]=>
object(MockingMagician\CoinbaseProSdk\Functional\DTO\OrderBookDetailsData)#46 (4) {
["price":"MockingMagician\CoinbaseProSdk\Functional\DTO\OrderBookDetailsData":private]=>
float(57588.79)
["size":"MockingMagician\CoinbaseProSdk\Functional\DTO\OrderBookDetailsData":private]=>
float(0.08184382)
["numOrders":"MockingMagician\CoinbaseProSdk\Functional\DTO\OrderBookDetailsData":private]=>
int(3)
["orderId":"MockingMagician\CoinbaseProSdk\Functional\DTO\OrderBookDetailsData":private]=>
NULL
}
}
Which seems not to be iterable (unless I'm not understanding how to iterate it), nor useful for calculations.
I've also read the docs stating something about the "levels" but I don't find documentation stating what does a level mean and how can it be used.
My use case is quite simple, I just need to use the order book to know what's the price I have to pay to buy x amount of the product.
Thank you very much for your time in reviewing this issue!
getCurrencies() is returning an object of MockingMagician\CoinbaseProSdk\Functional\DTO\CurrencyData instead of an array
Expected behavior
an array of currencies with child arrays of associated data
Screenshots
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
Fresh install with PHP 8
Hi,
I'm getting this error when using the package in a Laravel Job script, any ideas?
local.ERROR: NotFound {"exception":"[object] (MockingMagician\\CoinbaseProSdk\\Functional\\Error\\ApiError(code: 0): NotFound at /home/dca-x8rfh/website.com/vendor/mocking-magician/coinbase-pro-sdk/src/Functional/Request/Request.php:132)
[stacktrace]
#0 /home/dca-x8rfh/website.com/vendor/mocking-magician/coinbase-pro-sdk/src/Functional/Request/RequestWithErrorManagement.php(41): MockingMagician\\CoinbaseProSdk\\Functional\\Request\\Request->send()
#1 /home/dca-x8rfh/website.com/vendor/mocking-magician/coinbase-pro-sdk/src/Functional/Connectivity/Orders.php(127): MockingMagician\\CoinbaseProSdk\\Functional\\Request\\RequestWithErrorManagement->send()
#2 /home/dca-x8rfh/website.com/vendor/mocking-magician/coinbase-pro-sdk/src/Functional/Connectivity/Orders.php(135): MockingMagician\\CoinbaseProSdk\\Functional\\Connectivity\\Orders->getOrderByIdRaw()
#3 /home/dca-x8rfh/website.com/app/Jobs/RunStrategy.php(122): MockingMagician\\CoinbaseProSdk\\Functional\\Connectivity\\Orders->getOrderById()
#4 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\RunStrategy->handle()
#5 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#6 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#7 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#8 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\\Container\\BoundMethod::call()
#9 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#10 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#11 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#12 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#13 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\\Bus\\Dispatcher->dispatchNow()
#14 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#15 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/Middleware/WithoutOverlapping.php(71): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#16 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Queue\\Middleware\\WithoutOverlapping->handle()
#17 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\\Pipeline\\Pipeline->then()
#19 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#20 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#21 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(428): Illuminate\\Queue\\Jobs\\Job->fire()
#22 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\\Queue\\Worker->process()
#23 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(172): Illuminate\\Queue\\Worker->runJob()
#24 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\\Queue\\Worker->daemon()
#25 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#26 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#27 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#28 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#29 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#30 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\\Container\\BoundMethod::call()
#31 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#32 /home/dca-x8rfh/website.com/vendor/symfony/console/Command/Command.php(298): Illuminate\\Console\\Command->execute()
#33 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#34 /home/dca-x8rfh/website.com/vendor/symfony/console/Application.php(1005): Illuminate\\Console\\Command->run()
#35 /home/dca-x8rfh/website.com/vendor/symfony/console/Application.php(299): Symfony\\Component\\Console\\Application->doRunCommand()
#36 /home/dca-x8rfh/website.com/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()
#37 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\\Component\\Console\\Application->run()
#38 /home/dca-x8rfh/website.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#39 /home/dca-x8rfh/website.com/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#40 {main}
"} ```
$api = CoinbaseFacade::createDefaultCoinbaseApi($endpoint, $api_key, $api_secret, $passphrase);
//APis
$api->products()->getProducts('BTC-USD');
$api->products()->getSingleProduct('BTC-USD');
Error:
"message": "Undefined array key "base_min_size"",
file": "vendor\mocking-magician\coinbase-pro-sdk\src\Functional\DTO\ProductData.php",
Hello! what about methods to get real-time exchange market data?
Thanks!
So I used composer to install this package and after numerous warnings about running it as root (I did not, I deleted the vendor directory it made in the root directory) and ran it as an unprivileged user. The code is all there, but the make file refers most functions /vendor/bin/..... which does not exist and was not created. The php functions are all there, but I can't run your test files and I can't seem to use the Namespace you created to access the functions. The Makefile fails for every option but help.
The code looks good and it is just what I was looking for, but I've spent all evening trying to get it installed correctly. The docker tests looked like they were going to work (after installing docker and docker.io) but ended up in a loop saying:
cc -DONIG_ESCAPE_UCHAR_COLLISION=1 -DUChar=OnigUChar -DHAVE_CONFIG_H -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/usr/src/php/ext/mbstring -DPHP_ATOM_INC -I/usr/src/php/ext/mbstring/include -I/usr/src/php/ext/mbstring/main -I/usr/src/php/ext/mbstring -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/src/php/ext/mbstring/libmbfl -I/usr/src/php/ext/mbstring/libmbfl/mbfl -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c /usr/src/php/ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.c -fPIC -DPIC -o libmbfl/filters/.libs/mbfilter_iso8859_6.o
/bin/bash /usr/src/php/ext/mbstring/libtool --mode=compile cc -DONIG_ESCAPE_UCHAR_COLLISION=1 -DUChar=OnigUChar -DHAVE_CONFIG_H -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/usr/src/php/ext/mbstring -DPHP_ATOM_INC -I/usr/src/php/ext/mbstring/include -I/usr/src/php/ext/mbstring/main -I/usr/src/php/ext/mbstring -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/src/php/ext/mbstring/libmbfl -I/usr/src/php/ext/mbstring/libmbfl/mbfl -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c /usr/src/php/ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.c -o libmbfl/filters/mbfilter_iso8859_7.lo
Over and over.
I am running PHP 7.,4 on Ubuntu Linux 20.04 LTS. Could you provide a little more information than the one line install instruction in the docs? The rest of the docs are good and I think I could really use this if I can figure out the environment to get started.
It does not look like the package supports the latest version of Symfony. I haven't tested updating the composer.json file.
My problem:
The limit order feature fails because the tool cannot find LimitOrdertoPlace class
This feature provides an error when executing the complex limit order as listed on the website
not sure why it is not found...
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.