Effacer les filtres
Effacer les filtres

Trading with Alpaca API

16 vues (au cours des 30 derniers jours)
Vitaly Kheyfets
Vitaly Kheyfets le 1 Mar 2023
Hello -
Is there any documentation on using Matlab for pulling data, buying, selling, etc. using the Alpaca API?
It seems like almost all of the documentation is for Python.
Thanks,
Vitaly

Réponse acceptée

Dinesh
Dinesh le 7 Mar 2023
Modifié(e) : Dinesh le 7 Mar 2023
Hi Vitaly.
No, there is no documentation of using Alpaca API with MATLAB like it is available for Python.
There are no support packages available for it on Github as well.
But, it is possible to use MATLAB since Alpaca provides a REST API and any programming language that can make HTTP requests can use it.
The following example is on getting account information using Alpaca API in MATLAB:
url = 'https://api.alpaca.markets/v2/account';
options = weboptions('HeaderFields',{'APCA-API-KEY-ID','YOUR_API_KEY_ID_HERE';...
'APCA-API-SECRET-KEY','YOUR_API_SECRET_KEY_HERE'});
response = webread(url, options);
disp(response)
Replace "YOUR_API_KEY_ID_HERE" and "YOUR_API_SECRET_KEY_HERE" with your Alpaca API key ID and secret key, respectively. You can find your API keys on your Alpaca account dashboard.
"webread" is used for HTTP GET requests and "webwrite" can be used to make HTTP POST requests (for placing orders as an example). The response is returned as a JSON object.
Similary, you can use Alpaca's documentation to see the list of requests you can make and then use MATLAB to code them.
  1 commentaire
Vitaly Kheyfets
Vitaly Kheyfets le 9 Mar 2023
Thank You, Dinesh!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by