Comments (3)
-
I did multiple tests using the examples provided, also I have added a high-resolution clock to both C++ and the python code,
it is practically unnoticeable the difference.0.04ms~0.06ms
But still, python gets nice results 👍.
-
Regarding your question
(1) About the sendOrder API
You need to post-process manually
from binance-cxx-api.
Dear @baker-Xie thank you for your testing! I could imagine the first connection is slower than subsequent ones, due to initialization overhead. A lot of other aspects may be involved, depending on how the actual test is designed. Would it be possible for you to publish and/or attach here your test code for our further analysis?
from binance-cxx-api.
Dear @dmikushin , Thanks for you reply. I'll paste my code here.
(1) The first http call of binance-cxx-api is slow of course, but the rest http calls are slow too (800ms)
(2) The python library is python-binance, please use pip install python-binance to install it.
Meanwhile, I have a question
(1) About the sendOrder API
There is quantity and price parameter which is double . But from website, there is minQty and tickSize. So we should guarantee that our price/quantity parameter are multiple to minQty/tickSize. But in your API, price/quantity are double, and I didn't see further post-process about them. So, if I use this API, should I pass a valid price/quantity , or you code will post-process for me?
For example, minQty = 0.01 tickSize = 0.1
if my quantity is 0.015, my price is 1.12, should I just pass quantity=0.015 / price =1.12 to APi, or should I pass quantity = 0.01 and price = 1.1 to API?
c++ test code:
#include <iostream>
#include <json/json.h>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include "binance.h"
#include "binance_logger.h"
#include "binance_websocket.h"
#include "sys/time.h"
using namespace binance;
using std::map;
using std::vector;
using std::string;
using std::cout;
using std::endl;
unsigned long long GetTimestamp()
{
struct timeval temp;
gettimeofday(&temp, nullptr);
return temp.tv_sec * 1e6 + temp.tv_usec;
}
int main()
{
Json::Value result;
auto _server = new Server;
auto _market = new Market(*_server);
auto beginTime = GetTimestamp();
_market->getDepth(result, "LINKBTC", 5);
auto endTime = GetTimestamp();
cout << (endTime-beginTime) << endl;
beginTime = GetTimestamp();
_market->getDepth(result, "ETHTUSD", 5);
endTime = GetTimestamp();
cout << (endTime-beginTime) << endl;
beginTime = GetTimestamp();
_market->getDepth(result, "LINKETH", 5);
endTime = GetTimestamp();
cout << (endTime-beginTime) << endl;
beginTime = GetTimestamp();
_market->getDepth(result, "IOTABTC", 5);
endTime = GetTimestamp();
cout << (endTime-beginTime) << endl;
beginTime = GetTimestamp();
_market->getExchangeInfo(result);
endTime = GetTimestamp();
cout << (endTime-beginTime) << endl;
beginTime = GetTimestamp();
_market->getExchangeInfo(result);
endTime = GetTimestamp();
cout << (endTime-beginTime) << endl;
}
Pyhon test code:
from binance.client import Client as Client_Binance
from binance.enums import *
import time
binance_api_key = 'XXX'
binance_api_secret = 'XXX'
clientB = Client_Binance(binance_api_key, binance_api_secret)
beginTime = time.time()
depthB = clientB.get_order_book(symbol="LINKBTC", limit=5)
print(time.time() - beginTime)
beginTime = time.time()
depthB = clientB.get_order_book(symbol="ETHTUSD", limit=5)
print(time.time() - beginTime)
beginTime = time.time()
depthB = clientB.get_order_book(symbol="LINKETH", limit=5)
print(time.time() - beginTime)
beginTime = time.time()
depthB = clientB.get_order_book(symbol="IOTABTC", limit=5)
print(time.time() - beginTime)
beginTime = time.time()
depthB = clientB.get_order_book(symbol="IOTAETH", limit=5)
print(time.time() - beginTime)
from binance-cxx-api.
Related Issues (15)
- hi, did you try in on Centos7? HOT 2
- mbedcrypto error not built by this project HOT 9
- wsi-timeout scheduling validity check HOT 5
- Running example.cpp causes segmentation fault after PR #13 HOT 9
- another implementation of Binance API HOT 5
- Websocket error: lws_ssl_client_connect1 HOT 2
- multiple streams HOT 3
- Accessing futures websocket data stream HOT 3
- subscribe multiple streams limits?
- stepSize code HOT 1
- Certificate error? HOT 4
- Send a market order issue HOT 1
- osx compilation issue HOT 2
- ubuntu Segmentation fault HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binance-cxx-api.