Giter Site home page Giter Site logo

Comments (6)

kroitor avatar kroitor commented on May 8, 2024 1

Update: It's in The Manual now.

from ccxt.

nmiculinic avatar nmiculinic commented on May 8, 2024

Furthemore, this should simplify unit tests for pair name conversion (since I think there are still issues with this)

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

Hey! Thanks again for feedback, it's very constructive. Sure, I will expose the mapping.
In fact one half of that mapping (symbol → product id → symbol) is already there (you can use it right away):

# Python (almost identical to same code in JS and PHP, except for syntax)
symbol = 'BTC/USD'
print (market.products[symbol]['id']) # print product id by symbol
print (market.productId (symbol)) # same as previous line
product = market.product (symbol) get a full product dictionary by symbol
print (product['id']) # same as previous output

Will upload the other half (reworked) soon.

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

Though, the existing mapping does not throw errors, but returns the input string untouched. I will update that part of the interface anyway.

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

This feature will soon be ready, btw, Product Ids And Symbols. The Manual is frequently updated, I'm adding more and more details into it, so it's worth revisiting from time to time. I will also update it and add the two methods proposed here very soon.

from ccxt.

kroitor avatar kroitor commented on May 8, 2024

I've uploaded the interface to products, product symbols and product ids.
Here's how to use it:

import ccxt
k = ccxt.kraken ()
k.load_products ()

# symbol → product
k.products['BTC/USD']

# id → product
k.products_by_id['XXRPZUSD']

# symbol → id
k.products['BTC/USD']['id']

# id → symbol
k.products_by_id['XXRPZUSD']['symbol']

No functions, basic dictionaries indexed by appropriate fields. The are cached and can be force-reloaded if necessary.

You will get a userland standard Python exception if you access non-existent keys in these dicts.
I hope the above solution simplifies the usage, closing this issue down now. Will soon add it to the Manual. Thanks again!

from ccxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.