Hey @Tyler11, I tried your API keys in my script and i got some erros also from your keys.
I dont know why but apparently your account is out of funds, it might be good if you can show me the options actiaved for that API key, aslo double check that the account have funds (it should have like 100K $ and tons of btc and eth, since this is a testing environment, we are not using real money).
I know my code is working good, so it should be able to work with any API keys from gemini sandbox that I setup. Just in case you wanna verify some functions, here is my code:
//GEMINI CONFIG
const GeminiAPI = require("gemini-api").default
/*
//this are my personal API keys, for testing purposes only
const key = "account-5hmfRHz791N4PLpleOmJ";
const secret = "27sn6asLRQkipgKB68XMBR6QpuTq"
const geminiClient = new GeminiAPI({key, secret, sandbox:true});
*/
const key = "account-41t7eE3xxVNwd6A8BySs"
const secret = "6PoyyYUjK3TYtgwzhyFQ8BTup58"
const geminiClient = new GeminiAPI({key, secret, sandbox:true})
//GEMINI LOGIC
/*
// @dev Create new trade order
// @var _amount, float
// @var _price, int
// @var _side, string
// @var _symbol string
*/
function newOrder(_data, callback){
geminiClient.newOrder({amount:_data.amount,
price:_data.price,
side:_data.side,
symbol:_data.symbol,
options:_data.options})
.then(_res => {
callback(_res)
})
.catch(console.error);
}
/*
//Get all trading symbols Ex: "btcusd"
*/
function getAllSymbols(callback){
geminiClient.getAllSymbols()
.then(_res => {
callback(_res)
})
.catch(console.error);
}
/*
//get market price and data from a symbol Ex: "btcusd"
// @var _symbol string
*/
function getTicker(_symbol, callback){
geminiClient.getTicker(_symbol)
.then(_res => {
callback(_res)
})
.catch(console.error);
}
/*
//cancel an order by ID
// @var _order_id, integer
*/
function cancelOrder(_order_id, callback){
geminiClient.cancelOrder({order_id:_order_id})
.then(_res => {
callback(_res)
})
.catch(console.error);
}
/*
//cancel ALL my orders
*/
function cancelAllActiveOrders(callback){
geminiClient.cancelAllActiveOrders()
.then(_res => {
callback(_res)
})
.catch(console.error);
}
/*
//get all my trading active orders
// @var _symbol string
*/
function getMyActiveOrders(_symbol, callback){
geminiClient.getMyActiveOrders({symbol:_symbol})
.then(_res => {
callback(_res)
})
.catch(console.error);
}
/*
//get status from an order by ID
// @var _order_id, integer
*/
function getMyOrderStatus(_order_id, callback){
geminiClient.getMyOrderStatus({order_id:_order_id})
.then(_res => {
callback(_res)
})
.catch(console.error);
}
/*
//get Balances
// @var _symbol string
*/
function getMyAvailableBalances(_symbol, callback){
geminiClient.getMyAvailableBalances({symbol:_symbol})
.then(_res => {
callback(_res)
})
.catch(console.error);
}
module.exports =
{
newOrder,
getAllSymbols,
getTicker,
cancelOrder,
cancelAllActiveOrders,
getMyActiveOrders,
getMyOrderStatus,
getMyAvailableBalances
}
I think it could be a config on your API keys, try mines just to discard errors in your code.
Carlos Z