Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCXT Pro Websockets merged with CCXT! #15171

Open
kroitor opened this issue Oct 3, 2022 · 25 comments
Open

CCXT Pro Websockets merged with CCXT! #15171

kroitor opened this issue Oct 3, 2022 · 25 comments
Assignees
Labels
announcement enhancement important Higher priority ws Websockets (a.k.a. PRO)

Comments

@kroitor
Copy link
Member

kroitor commented Oct 3, 2022

Dear users of CCXT and CCXT Pro!

We are happy to announce the merge of CCXT Pro into CCXT.
CCXT Pro is now a part of the free CCXT package as of version 1.95+
All of the CCXT Pro Websocket functionality is retained in CCXT.
Please, make sure to upgrade your scripts accordingly.
You can find the examples here:

All feedback is very welcome and is especially valued during this period of transition.

A word to existing CCXT Pro users: please, ignore the subscription expiry notifications and switch to CCXT. Don't hesitate to reach out to us here on GitHub and in Discord (https://discord.gg/ccxt) in case you have any difficulties migrating or if you have any questions regarding the merge.

Thanks for using CCXT!

Yours faithfully,
The CCXT Dev Team.

@kroitor kroitor added enhancement announcement ws Websockets (a.k.a. PRO) important Higher priority labels Oct 3, 2022
@kroitor kroitor self-assigned this Oct 3, 2022
@kroitor kroitor pinned this issue Oct 3, 2022
@jshcrowthe
Copy link

First of all thanks to all on the hard work here! As a user, the added OSS functionality is much appreciated.

I noticed that the API surface has now changed. Whereas before the import scheme was:

import * as ccxt from ccxt;

// Do CCXT things

Importing CCXT as originally documented the watch functionality is not available. Instead I have to import at the pro subpath:

ESM
import { pro as ccxt } from ccxt;

// Do CCXT things
CommonJS
const ccxt = require('ccxt').pro;

// Do CCXT things

Is the plan here to merge both API interfaces into one? Or is the "pro" entrypoint going to be an ongoing thing?

@frosty00
Copy link
Member

frosty00 commented Oct 3, 2022

@jshcrowthe we're going to add esm support soon #12619

@xiguakaoya
Copy link

thx!

@ambrosestartup
Copy link

Thank you!

@jshcrowthe
Copy link

jshcrowthe commented Oct 3, 2022

@frosty00 I mean less about strict ESM support (as you can emulate that w/ any modern build system these days) and more the specifics of having to explicitly reference require('ccxt').pro in order to get the watch behavior.

Is the plan to make it so someone doing const ccxt = require('ccxt') gets the watch behavior (and therefore requires the consolidation of the implementations for ccxt and ccxt.pro, or are y'all wanting to keep them separate?

i.e. should the following snippet work?

const ccxt = require('ccxt');

async function main() {
  const exchange = new ccxt.ftx();
  const book = await exchange.watchOrderBook();
  console.log(book);
}

main();

And if not, what's the rationale?

@suenot
Copy link

suenot commented Oct 3, 2022

Игорь, спасибо тебе!

@suenot
Copy link

suenot commented Oct 3, 2022

Simple example:

const ccxt = require ('ccxt').pro;

(async () => {

  const exchange = new ccxt.binance({ enableRateLimit: true })

  while (true) {
    const orderbook = await exchange.watchOrderBook('ETH/BTC')
    console.log (new Date (), orderbook['asks'][0], orderbook['bids'][0])
  }

}) ()

@pottertech
Copy link

I am on PHP 7.4 but the composer.json in the package says it requires PHP 8.1. What requires 8.1 in the ccxt package?

@carlosmiei
Copy link
Collaborator

@pottertech React/Async
https://reactphp.org/async/

@pottertech
Copy link

@carlosmiei Thanks, I changed the required block in the ccxt/composer.json file to this:

"require": {
    "php": ">=7.4.0",
    "ext-bcmath": "*",
    "ext-curl": "*",
    "ext-iconv": "*",
    "ext-pcre": "*",
    "ext-json": "*",
    "ext-openssl": "*",
    "ext-gmp": "*",
    "symfony/polyfill-mbstring": "^1.7",
    "pear/console_table": "1.3.1",
    "ratchet/pawl": ">=0.4.1",
    "react/http": ">=1.6.0",
    "react/async": "^3"
},

then did command: composer update

And everything seems to be working fine now for PHP 7.4

@pottertech
Copy link

After installing CCXT with the following command: git clone https://github.com/ccxt/ccxt.git --depth 1

I am ready to update CCXT but I am not sure what the command is to do it correctly. Can someone help me out please?

@jorisw
Copy link
Contributor

jorisw commented Nov 5, 2022

@pottertech Cloning a source repository is not the correct way to use most open source libraries. Rather, it involves importing the module into your project. How this is done depends on your choice of scripting language. See the wiki install docs.

@pottertech
Copy link

Thank you.

@simonblack
Copy link

simonblack commented Dec 12, 2022

Hey all, are requests to the websocket endpoints "real" event subscriptions (and connections kept open) or are they just single api requests? Wondering why it seems like the connections are closed right after a request / why requests have to be performed one at a time within a loop.

Lets use binance for this question, should you need an exchange in particular. And python, should you need the language being used.

Thanks!

@carlosmiei
Copy link
Collaborator

Hey all, are requests to the websocket endpoints "real" event subscriptions (and connections kept open) or are they just single api requests? Wondering why it seems like the connections are closed right after a request / why requests have to be performed one at a time within a loop.

Lets use binance for this question, should you need an exchange in particular.

Thanks!

Hello @simonblack,
They are real event subscriptions and the connection is kept open. Now, depending from exchange to exchange, we might establish different connections if they require to.

@simonblack
Copy link

Hey all, are requests to the websocket endpoints "real" event subscriptions (and connections kept open) or are they just single api requests? Wondering why it seems like the connections are closed right after a request / why requests have to be performed one at a time within a loop.
Lets use binance for this question, should you need an exchange in particular.
Thanks!

Hello @simonblack, They are real event subscriptions and the connection is kept open. Now, depending from exchange to exchange, we might establish different connections if they require to.

Thanks a lot!

@HawtDogFlvrWtr
Copy link

Where's the best place to donate?

@bugb
Copy link

bugb commented Mar 14, 2023

@kroitor Thank you so much for make it free for everyone, much appreciated!

@kroitor kroitor unpinned this issue Mar 21, 2023
@muhammad-rizwan-brainx
Copy link

Do all the exchanges in ccxt support WSS?

@carlosmiei
Copy link
Collaborator

Do all the exchanges in ccxt support WSS?

@muhammad-rizwan-brainx Not all of them but a significant part do, you can check it here https://github.com/ccxt/ccxt#supported-cryptocurrency-exchange-markets

@muhammad-rizwan-brainx
Copy link

Can I transfer funds from one exchange to another with CCXT?
@carlosmiei

@carlosmiei
Copy link
Collaborator

Can I transfer funds from one exchange to another with CCXT? @carlosmiei

@muhammad-rizwan-brainx Yes, by using the withdraw method.

@muhammad-rizwan-brainx
Copy link

fetchDepositAddress would be used to get the address of account ? I am trying it with kraken exchange but it's not working
@carlosmiei

@carlosmiei
Copy link
Collaborator

fetchDepositAddress would be used to get the address of account ? I am trying it with kraken exchange but it's not working @carlosmiei

@muhammad-rizwan-brainx Pls open a new issue, this one is not meant for these discussions.

@carlosmiei
Copy link
Collaborator

@Arsam1313 Can you please open a different issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
announcement enhancement important Higher priority ws Websockets (a.k.a. PRO)
Projects
None yet
Development

No branches or pull requests

15 participants