darwinex / darwin-api-tutorials

Tutorial videos, posts, and source code in Python & R to assist algorithmic traders and DARWIN investors in getting up and running with the DARWIN API.
https://www.youtube.com/watch?v=IDDHyjqt_TY&list=PLv-cA-4O3y96EwRy0T6Y6CY52_x9Zdec9
25 stars 26 forks source link

Problem with API example darwinexapis/darwinexapis/EXAMPLE_SCRIPTS/DarwinAPIClassesExample.py #7

Closed AdamAdamsson closed 3 years ago

AdamAdamsson commented 3 years ago

Hi, I am experimenting with your API package for Python and using your exemple script DarwinAPIClassesExample.py.

I have activated the following code in the example:

Let's create the access token variable:

AUTH_CREDS = {'access_token': 'fe1e00f4-bdf6-313d-915b-3ac4eea325d1', 'consumer_key': 'IR5UvEGyEMK8combIVBLbcof_WMa', 'consumer_secret': 'WKcuZy981a14pmvyj1cPTK6cjo4a', 'refresh_token': '1e109063-4a36-3565-86d6-d9d46c2e7467',}

darwinexInfo = DWX_Info_API(AUTH_CREDS, _version=2.0, _demo=True)

DWX_Info_API:

darwinUniverse = darwinexInfo._Get_DARWINUniverse(_status='ACTIVE', _iterate=True, _perPage=50) pprint.pprint(darwinUniverse) darwinUniverse.to_csv('/Users/Dan/darwin-api-tutorials-master/PYTHON/NOTEBOOKS/12_quant_workflow_algo_trading_darwin_api/darwinUniverse.csv')

When I run the code, I receive the following message:

[INIT] - Creating AUTH creds... [INIT] - Access token will be created again at 1599829976.2918148 UNIX timestamp [INIT] - Creating AUTH creds... [INIT] - Access token will be created again at 1599829976.292811 UNIX timestamp [DarwinInfoAPI] Getting first 50 DARWINs..

[DECORATOR] - The expiration time has NOT reached yet > Continue... FULL URL ENDPOINT : https://api.darwinex.com/darwininfo/2.0/products?status=ACTIVE&page=0&per_page=50 <Response [403]> {"fault":{"code":900908,"message":"Resource forbidden ","description":"Access failure for API: /darwininfo/2.0, version: 2.0 status: (900908) - Resource forbidden "}}

It appears that I need "Authorization: Bearer ACCESS_TOKEN", but I do not know how to do that. I have provided the authorization tokens above that is newly created on https://www.darwinex.com/data/darwin-api.

I would very much appreciate your assistance.

integracore2 commented 3 years ago

Hi @AdamAdamsson ,

Could you kindly confirm if you are using the darwinexapis Python package?

If you are, kind post this Issue in https://github.com/darwinex/darwinexapis/issues so one of my colleagues assigned there can take a look for you πŸ‘

AdamAdamsson commented 3 years ago

Hi Ali, Yes, I have installed the darwinexapis Python package through

pip install darwinexapis

I have also made a post regarding this issue at https://github.com/darwinex/darwin-api-tutorials/issues

On Mon, Sep 14, 2020 at 10:47 AM Ali Saif notifications@github.com wrote:

Hi @AdamAdamsson https://github.com/AdamAdamsson ,

Could you kindly confirm if you are using the darwinexapis Python package?

If you are, kind post this Issue in https://github.com/darwinex/darwinexapis/issues so one of my colleagues assigned there can take a look for you πŸ‘

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/darwinex/darwin-api-tutorials/issues/7#issuecomment-691914205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ6XIL6ZQGNJEGSMLCMAEF3SFXKCBANCNFSM4RHQAPHA .

integracore2 commented 3 years ago

Hi @AdamAdamsson

Yes, kindly post this Issue in https://github.com/darwinex/darwinexapis/issues so one of my colleagues assigned there can take a look for you πŸ‘

Issues to do with the package are handled directly in its repository (this is the darwin-api-tutorials repo)

Many thanks!

AdamAdamsson commented 3 years ago

OK, I have made a copy of this issue at https://github.com/darwinex/darwinexapis/issues

integracore2 commented 3 years ago

Thanks @AdamAdamsson πŸ‘Œ

I'll CC'ed my colleague there to assist.