bingx-api's People
bingx-api's Issues
Implement listen key validity period
Price: 10$
Acceptance criteria:
- Endpoint class described
- ListenKeyService contains method
- Unit tests
Implement this endpoint
Change latest trade detail ws event interface
Price: 5$
got message as fact is
{
"code":0,
"dataType":"BTC-USDT@trade",
"data":[
{
"q":"0.1783",
"p":"26615.4",
"T":1697132867944,
"m":true,
"s":"BTC-USDT"
}
]
}
Describe is not defined
implement partially of websocket market
implement websocket market from #2
Global Service instance proposal
Cases
1. Create global service instance
import { ApiAccount } from "./api-account";
const account = new ApiAccount('xxx', 'xxx');
const bingxApiClient = new BingxApiClient();
const listenKey = await bingxApiClient
.getListenKeyService()
.generateListenKey(account);
bingxApiClient
.getListenKeyService()
.extendListenKeyValidityPeriod(listenKey, account);
bingxApiClient
.getListenKeyService()
.deleteListenKey(listenKey, account);
- Override internal bingx request class
Implement custom request class
class RmqCustomRequest<T> implements BingxRequestInterface<T> {
constructor(
private readonly endpoint: EndpointInterface<T>,
private readonly rmqClient: RmqClient,
private readonly storage: AsyncStorage,
) {}
async getEndpoint(): Promise<Readonly<EndpointInterface<T>>> {
return this.endpoint;
}
getResponse(): Promise<Readonly<BingxResponseInterface<T>>> {
// logic
}
}
override request
import { EndpointInterface } from "./endpoint.interface";
const account = new ApiAccount('xxx', 'xxx');
const bingxApiClient = new BingxApiClient()
.overrideRequestExecutor((endpoint: EndpointInterface) => {
return new RmqCustomRequest(
endpoint,
app.get(RmqClient),
app.get(AsyncStorage),
);
});
// request will sent into rmq
const listenKey = await bingxApiClient
.getListenKeyService()
.generateListenKey(account);
- Using nestjs modules API
common usages
@Module({
imports: [BingXModule]
})
export class AppModule {}
Configurable usage
@Module({
imports: [
BingXModule.configure({
imports: [RequestContext, RmqModule],
overrideRequestExecutor: {
provider: RmqCustomRequest,
inject: [RmqClient, AsyncStorage],
},
})
]
})
export class AppModule {}
Implement deletion listen key
Price: 10$
Acceptance criteria:
- Endpoint class described
- ListenKeyService contains method
- Unit tests
Implement this endpoint
Implement switch leverage
Fix code scanning alert - Disallow unused variables
Export socket functionallity
now can use websocket only ugly import
import { BingxAccountSocketStreamPool } from "bingx-api/dist/bingx-socket/bingx-account-socket-stream-pool";
add readme description
Implement websocket account data stream
Select feature account data stream from proposal #2
Requirements:
- heartbeat
- listenKeyExpired
- accountUpdate
- orderTradeUpdate
- accountConfigUpdate
- Automatically refresh/extend live for listen key
Account stream
- think about how to support exchange listen key with custom requests
const account = new ApiAccount('x', 'x')
const accountStream = new BingxWebSocketAccountStream(account);
accountStream.hearbeat$.subscribe();
// Listen key expired
accountStream.listenKeyExpired$.subscribe();
// Account balance and position update push
accountStream.accountUpdate$.subscribe();
// Order update push
accountStream.orderTradeUpdate$.subscribe();
// Configuration updates
accountStream.accountConfigUpdate$.subscribe();
Fix code scanning alert - Disallow unused variables
Implement switch margin mode
implement user history orders
Implement websocket account stream pool
request from #2
Account stream pool
Supports multiple account stream
const accountStreamPool = new BingxWebSocketAccountStreamPool(accounts);
//
accountStreamPool.hearbeat$.subscribe(account => {});
// Add user
accountStreamPool.addAccount(account);
// Remove user
accountStreamPoll.removeAccount(account);
// Listen key expired
accountStreamPool.listenKeyExpired$.subscribe((data, account) => {});
// Account balance and position update push
accountStreamPool.accountUpdate$.subscribe((data, account) => {});
// Order update push
accountStreamPool.orderTradeUpdate$.subscribe((data, account) => {});
// Configuration updates
accountStreamPool.accountConfigUpdate$.subscribe((data, account) => {});
Cannot go to type declarion of bignx client services
account websocket pool not emit any events
Price: 10$
fix bigint order id problem
Notice:in nodeJS when you converts original resp(string) to json, order id is a big-int in some response
it may have big-int issue, will be transformed automatically
for example: order id: 172998235239792314304 -be transformed automatically to-->172998235239792314300
if you find something wrong with order id like 'order not exist' or found the order id suffix with 00 or more 0, chould be the reason
then can print the original response like below to check the origianl order id
https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order%20test
relates problem to nodejs
setup git semver
Create issues for implementation endpoint
Price: 10$
Requirements
- Created all tickets for endpoints with unchecked status in README
- Created tickets does not have "paid" labels
- Each ticket on 1st line has ref to wiki paid tickets page
Description: create issues for implement endpoints which has unchecked status in README.md
You can use this issue as reference
Each issue must be has price 10$
Fix code scanning alert - Disallow unused variables
Websocket proposal
Supports websocket functionality
Market data
const marketStream = new BingxWebSocketMarketStream();
// Heartbeat
marketStream.hearbeat$.subscribe();
// Market Depth data
marketStream.subscribeMarketDepthData({
symbol: 'BTC-USDT',
level: 5,
});
marketStream.marketDepthData$.subscribe((data) => {
console.log(data);
});
// Latest Trade Detail
marketStream.subscribeLatestTradeDetail({
symbol: 'BTC-USDT'
});
marketStream.latestTradeDetail$.subscribe((data) => {
console.log(data);
});
// Subscribe K-Line Data
marketStream.subscribeKLineData({
symbol: 'BTC-USDT',
interval: '1m'
});
marketStream.kLineData$.subscribe(data => {
console.log(data);
});
Account stream
- think about how to support exchange listen key with custom requests
const account = new ApiAccount('x', 'x')
const accountStream = new BingxWebSocketAccountStream(account);
accountStream.hearbeat$.subscribe();
// Listen key expired
accountStream.listenKeyExpired$.subscribe();
// Account balance and position update push
accountStream.accountUpdate$.subscribe();
// Order update push
accountStream.orderTradeUpdate$.subscribe();
// Configuration updates
accountStream.accountConfigUpdate$.subscribe();
Account stream pool
Supports multiple account stream
const accountStreamPool = new BingxWebSocketAccountStreamPool(accounts);
//
accountStreamPool.hearbeat$.subscribe(account => {});
// Add user
accountStreamPool.addAccount(account);
// Remove user
accountStreamPoll.removeAccount(account);
// Listen key expired
accountStreamPool.listenKeyExpired$.subscribe((data, account) => {});
// Account balance and position update push
accountStreamPool.accountUpdate$.subscribe((data, account) => {});
// Order update push
accountStreamPool.orderTradeUpdate$.subscribe((data, account) => {});
// Configuration updates
accountStreamPool.accountConfigUpdate$.subscribe((data, account) => {});
account order update event dont contain order types
Built in types for api client not works
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.