Skip to content

Commit

Permalink
1.10.861
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jan 27, 2018
1 parent 1371a92 commit 606bf2a
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 36 deletions.
4 changes: 2 additions & 2 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.10.860'
const version = '1.10.861'

Exchange.ccxtVersion = version

Expand Down
38 changes: 11 additions & 27 deletions doc/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -776,39 +776,23 @@ The endpoint URLs are predefined in the ``api`` property for each exchange. You
Implicit API Methods
--------------------

ccxt uses a declarative approach for defining exchange's native (non-unified) API methods.
These methods are declared in exchange's ``api`` property in the following manner:
Most of exchange-specific API methods are implicit, meaning that they aren't defined explicitly anywhere in code. The library implements a declarative approach for defining implicit (non-unified) exchanges' API methods.

::
Each method of the API usually has its own endpoint, the library defines all endpoints for each particular exchange in the ``.api`` property. Upon exchange construction an implicit *magic* method (aka *partial function* or *closure*) will be created inside ``defineRestApi()/define_rest_api()`` on the exchange instance for each endpoint from the list of ``.api`` endpoints. Ths is performed for all exchanges universally. Each generated method will be accessible in both ``camelCase`` and ``under_score`` notations.

'api': {
'public': { // type
'get': [ // http method
'products', // path
'open/tick', // another path
...
],
},
'private': {
'post': [
'order/{id}',
...
],
'put': [
'order/{id}/cancel',
...
],
},
},
Each implicit method gets a unique name which is constructed from the ``.api`` definition. For example, with a private HTTPS PUT ``https://api.exchange.com/order/{id}/cancel`` endpoint the corresponding exchange method would be named ``.privatePutOrderIdCancel()``/``.private_put_order_id_cancel()``, having a public HTTPS GET ``https://api.exchange.com/market/ticker/{pair}`` endpoint would result in the corresponding method named ``.publicGetTickerPair()``/``.public_get_ticker_pair()``, and so on...

Upon exchange instantiation ``defineRestApi/define_rest_api`` base exchange method will use these declarations to create
*magic functions* (aka *partial functions* or *closures*) inside the exchange subclass.
The endpoints definition is a **full list of ALL API URLs** exposed by an exchange. This list gets converted to callable methods upon exchange instantiation. Each URL in the API endpoint list gets a corresponding callable method. This is done automatically for all exchanges, therefore the ccxt library supports **all possible URLs** offered by crypto exchanges.

Taken the example above these magic functions will take the names of ``publicGetProducts``, ``publicGetOpenTick``, ``privatePostOrderId``, ``privatePutOrdersIdCancel``.
An implicit method takes a dictionary of ``params``, sends the request to the exchange and returns an exchange-specific JSON result from the API **as is, unparsed**. The recommended way of working with exchanges is not using exchange-specific implicit methods but using the unified ccxt methods instead. The exchange-specific methods should be used as a fallback in cases when a corresponding unified method isn't available (yet).

When you call one of these magic functions (e.g. ``privatePutOrdersIdCancel ({ id: 100 })``), it will call ccxt's ``request`` method with ``type``, ``http method``, ``path`` and ``params`` arguments. In turn, ``request`` then implodes ``params`` into ``path`` (and ``query`` if necessary), adds ``scheme`` ([http\|https]) / ``host`` and performs actual ``fetch`` which will return raw API response.
To get a list of all available methods with an exchange instance, including implicit methods and unified methods you can simply do the following:

The endpoints definition is a **full list of ALL API URLs** exposed by an exchange. This list gets converted to callable methods upon exchange instantiation. Each URL in the API endpoint list gets a corresponding callable method. This is done automatically for all exchanges, therefore the ccxt library supports **all possible URLs** offered by crypto exchanges.
::

console.log (new ccxt.kraken ()) // JavaScript
print (dir (ccxt.hitbtc ())) # Python
var_dump (new \ccxt\okcoinusd ()); // PHP

Public/Private API
------------------
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ccxt",
"version": "1.10.860",
"version": "1.10.861",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 90+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
2 changes: 1 addition & 1 deletion php/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.10.860';
$version = '1.10.861';

abstract class Exchange {

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# ----------------------------------------------------------------------------

__version__ = '1.10.860'
__version__ = '1.10.861'

# ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.860'
__version__ = '1.10.861'

# -----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.860'
__version__ = '1.10.861'

# -----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.860'
__version__ = '1.10.861'

# -----------------------------------------------------------------------------

Expand Down

0 comments on commit 606bf2a

Please sign in to comment.