gateio / gateapi-nodejs Goto Github PK
View Code? Open in Web Editor NEWTypeScript client SDK for Gate APIv4 used in NodeJS(can be compiled to javascript)
TypeScript client SDK for Gate APIv4 used in NodeJS(can be compiled to javascript)
How to authorize with gate.io api key using this lib ?
// I want to do somthing like this
const client = new GateApi.ApiClient("API_KEY");
I have tried to make Websocket calls with auth without success so far.
I suggest adding a SIGN for futures Websocket requests.
Scenario:
I place a IOC order using createOrder
, status === closed
in response, then immediately I call listMyTrades
using the order crypto_pair and the order_id.
Expected: the listMyTrades
request should return trades array.
Actual: Response is an empty array
If i wait few seconds and call the listMyTrades
again using the order crypto_pair and the order_id I correctly recieve the trades in the response.
Is this the correct behavior?
每次我用gateapi进行提现操作,结果返回了请求成功,但是我每次的提现单号都会进入1~8小时的安全审核状态,让我人工处理。
我检查了平台apiv4的白名单和权限都没问题。
请问下有什么办法能够避免这种情况呢?
Hello. Is there a reason why there are some critical attributes on Futures API that are optional?
Example: https://github.com/gateio/gateapi-nodejs/blob/master/model/futuresOrderBookItem.ts
In the FuturesOrderBookItem
, p
for price and s
for size are both optional, even tho they are both always present.
Another example is the FuturesOrderBook
itself: https://github.com/gateio/gateapi-nodejs/blob/master/model/futuresOrderBook.ts
current
and update
- as I can see from the documentation - are always present.
Thanks in advance =)
Could You please provide information where to put auth information for us developers? Where should i pass username and password to ApiCLient? How?
edit: I found that setApiKeySecret() function is missing from ApiClient.js!
it is present in ts version , please fix this
I would like to place an order to close a long position in futures dual position mode.
The API manual says "In dual position mode, to close one side position, you need to set auto_size side, reduce_only to true and size to 0",
so I coded and ran it as follows.
const params = { contract: symbol, size: 0, price: 0, auto_size:"close_long", reduce_only: true, tif: "ioc" };
createFuturesOrder("usdt", params);
If I run it, I see an 'invalid size with close-order' error message.
If I change that code to size: 1
and run it, a long position is created,
If I change size: -1
, a short position is created.
How can I close my positions?
Made the following request using `listTickers` at 3:11:40 AM UTC
{
currencyPair: 'MASK_USDT',
last: '13.5',
...
}
Using listCandlesticks
with 10sec
interval received the following historical for the same currency pair at at
3:11:40 AM UTC
{
currencyPair: 'MASK_USDT',
close: '11.44',
...
}
If i want to retrieve realtime price for currency pair is listTickers
best suited for this?
The listCandlesticks
historical snapshot seem to match the Gate.io Webapp graph , the listTickers
seem way off. is this due to caching ?
Should i use the listOrderBook
function instead ?
Any guidance will be much appreciated.
Hello, I want to create a spot order through this guide:
https://github.com/gateio/gateapi-nodejs/blob/master/docs/SpotApi.md#createOrder
But I am getting a error with the example code:
gateSpotOrders.js:8
const order = new Order(); // Order |
^
ReferenceError: Order is not defined
https://github.com/gateio/gateapi-nodejs/blob/master/docs/Order.md
Is there any fix for this or how do I create a order? In the API its simple json but no details on how to do it with the nodejs package
I got double order when calling the function createOrder
This is my code
const createOrder = (price, amount, side) => {
const api = new GateApi.SpotApi(client);
const order = new Order(); // Order |
order.price = price; // string | Order price
order.amount = amount; // string | Order amount
order.side = side; // string | Order side
order.currencyPair = currencyPair; // string | Currency pair
api.createOrder(order).then(
(value) =>
console.log("API called successfully. Returned data: ", value.body),
(error) => console.error(error)
);
};
Thanks!
I want to get single currency balance like "SIN" balance.
But there is just "GET /wallet/total_balance" to get total balance,this endpoint returns an approximate sum of exchanged amount from all currencies to input currency for each account.
Is there any way to get it?
Thank You!
I didn't fully understand futures order. For example, I will buy $5 dogecoin. I couldn't understand how to enter 5 dollars into the API. Can you help me? I think I need to set this $5 with another api request. But how and where do I do it?
By looking at the process on the web, I enter size as 1 and price as 0. In this case, it tries to do the same thing I did last time on the web.
Hi
I didn't use json parse. How take Currency and available ?
[ SpotAccount { currency: 'BTC', available: '0', locked: '0' } ]
This is the response i am getting by calling listFuturesOrders
where i place this order with size of 0.1 BTC
But i am getting Integer value
Note i am using future testnet
FuturesOrder {
id: 730839938,
user: 11867749,
createTime: 1657354368.131,
finishTime: undefined,
finishAs: undefined,
status: 'open',
contract: 'BTC_USDT',
size: 1000,
iceberg: 0,
price: '21486.5',
close: undefined,
isClose: false,
reduceOnly: undefined,
isReduceOnly: false,
isLiq: false,
tif: 'gtc',
left: 1000,
fillPrice: '21486.5',
text: 'web',
tkfr: '0.0005',
mkfr: '0.00015',
refu: 0,
autoSize: undefined
}
Using this Lib when i query my account trades , i have noticed the trade amount
and price
retrieved value is less precise than the value viewable on the webapp. i.e
Using webapp at https://www.gate.io/myaccount/myhistory
shows the following for a trade :
price: 0.000000022
amount: 16,132,646.41444999911
Using gateapi-nodejs
lib and calling listMyTrades
function i receive the following:
price: 0.00000002
amount: 16,132,646.41445
The Issue: Notice the gateapi-nodejs
lib response has less digits after the decimal place
How can i receive a more precise values.
Hello, I tried to fetch my trade history by calling ”new GateApi.SpotApi(client).listMyTrades(currencyPair, options)" with specifying time range.
But I got an error response saying data: { label: 'INVALID_PARAM_VALUE', message: 'invalid time range' }
.
I specified "from: 1648772732" and "to: 1652771175", which is from 4/1 to 5/17.
It works when I don't specify the "to" param but it only gives me trade history for one week since 4/1.
Is there any max time range we can specify?
How long can I specify the time range?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.