rentorm / 3commas-api-node Goto Github PK
View Code? Open in Web Editor NEWNodeJS wrapper for Official 3commas API
License: GNU General Public License v3.0
NodeJS wrapper for Official 3commas API
License: GNU General Public License v3.0
It appears that Update TP
has been deprecated:
The new API uses update deal(deal_id)
Would you be able to add support for update deal endpoint?
Good Evening,
I have been seeing errors in my logs for the last week or so that cropped up from no code change. I use kucoin as my exchange and I update the bot settings when new pairs are added. Over the last few weeks I have seen the coins go from 790 to over 830 and sometime from 820ish I started seeing the exception
FetchError: invalid json response body at https://api.3commas.io/public/api/ver1/bots/** reason: Unexpected end of JSON input
I was still able to use the same endpoint with a smaller list, but I am unable to update the list with all current kucoin USDT pairs.
I propose for POST/PUT calls we use the body instead of a query string within
async makeRequest(method, path, params) { on line 24 in threeCommasAPI class.
From 3Commas documentation:
I'd love to see this package add support for 3c's grid bots!
With the updated version, 3commas says the signature is not valid anymore for me? Did they also change something about that process?
Object {error: "signature_invalid", error_description: "Provided signature is invalid"}
Hi rentorm,
Do you think it would be possible to create this for R?
As I struggle to use 3commas' API in R, this would be very helpful in fetching my data from 3commas using R scripts.
Best,
Rhydderch
There is new version of smart trades, let's add it!
https://github.com/3commas-io/3commas-official-api-docs/blob/master/smart_trades_v2_api.md
i used below example but it always update the pairs "with last pair in the array", below is an example
const botUpdate = async () => {
let data = await api.botUpdate(
{
name: 'ABC',
pairs: [ 'USDT_BTC', 'USDT_ADA', 'USDT_XRP' ],
base_order_volume: '10.0',
take_profit: '0.2',
safety_order_volume: '10.0',
martingale_volume_coefficient: '0.5',
martingale_step_coefficient: '0.25',
max_safety_orders: 2,
active_safety_orders_count: 2,
safety_order_step_percentage: '1.0',
take_profit_type: 'total',
strategy_list: [
{ options: {time: "1m", type: 'buy_or_strong_buy'}, strategy: 'trading_view' }
],
bot_id: XXXXXXXXX
}
)
}
botUpdate()
1st Issue: the trading pairs is only updated to the single last pair
2nd Issue: strategy_list is not updated in the bot at all
There is a param to force request mode between 'real' or 'paper' on your account, see:
https://github.com/3commas-io/3commas-official-api-docs#api-modesreal-or-paper
Goal is to have possibility to force this option.
Sell steps (e.g. in a Smart Trade) are not being passed on the 3C API properly. Given a JSON object that contains e.g.
{ ...
take_profit_type: 'step_sell',
take_profit_step_orders:
[ { percent: 40, price: 0.000062, price_method: 'bid' },
{ percent: 30, price: 0.000069, price_method: 'bid' },
{ percent: 20, price: 0.000074, price_method: 'bid' },
{ percent: 10, price: 0.000080, price_method: 'bid' } ],
... }
The API will return an error, because querystring.stringify()
will render the JSON array as an empty property (...&take_profit_step_orders=&...
).
{ error: 'record_invalid',
error_description: 'Invalid parameters',
error_attributes:
{ 'take_profit_step_orders[percent]': [ 'is missing' ],
'take_profit_step_orders[price_method]': [ 'is missing' ] } }
I get FetchError: invalid json response body at https://api.3commas.io/public/api/ver1/deals?account_id=*** reason: Unexpected token R in JSON at position 0
If I hit it to many times.
Code to replicate:
const run = async function run() {
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const results = await Promise.all(arr.map(async () => client.makeRequest('GET',
'/public/api/ver1/deals?',
{ account_id: *** })));
console.log(results);
};
run().catch((err) => { console.log('Caught error', err); });
Readme says to use botsUpdate
, but the actual api is botUpdate
Hi There,
I am trying to update a bot automatically, I have been able to do this successfully with a single pair bot but now I am trying with a multi-pair bot it will only accept the last value in the list of pairs.
Please see snippet below:
In this instance, the values for the bot update, but the pairs become only "USDT_ADA".
I have seen mentions about using JSON instead of these arrays, but not sure how I would need to modify the index.js files to make this work?
Any help would be greatly appreciated!
Cheers,
{ "account_id": 1, "pair": "USDT_BTC", "instant": "true", "position": { "type": "buy", "units": { "value": "0.01" }, "order_type": "market" } }
querystring.stringify does not give correct params to send out in URL. I had to use qs to make it work.
According to 3commas official API docs, the base endpoint has changed to https://api.3commas.io/public/api.
Could you please update the base endpoint and ship an update of the library?
Thanks
Make this library simple and as pure wrapper (which it basically is), so it can support any current 3commas API methods.
This is already possible in v1.*, using following example:
const api = require('3commas-api-node')
const apiCall = new api({
apiKey: '',
apiSecret: ''
})
// get last 20 active deals
const showActiveDeals = async () => {
let data = await apiCall.makeRequest(
// method
'GET',
// path
'/public/api/ver1/deals?'
// params
{
limit: 20,
scope: 'active',
})
console.log(data)
}
showActiveDeals()
Proposal is to remove all other functions, just leave makeRequest
function and release it as v2. Update README with example usage and noting deprecated functions included in v1.*
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.