-
Notifications
You must be signed in to change notification settings - Fork 2k
Bitfinex support for 4.x #154
Comments
please elaborate? |
APIs are different in trading or even taking products/pairs from exchanges. I do not know how to get trading from exchange.js to engine.js, as I see engine trade function is made to work with gdax API (buy and sell). Bitfinex API has new_order to execute trading of both type. Maybe I should dig deeper, but I have poor programming skills as it's my hobby not the main resource to make living;) |
not a problem, just have the buy/sell functions in exchange.js each send a different order type to new_order. Nothing that would necessitate changing engine.js yet. There are bound to be some weird differences between exchange api's, and I'm currently dealing with one of them: some API's return historical data backwards and some forwards in time. Some API's don't have historical data, which I'm trying to fall back to a 3rd party API if possible. These things are why I haven't released 4.0 yet because the zenbot API needs to be stable (and account for exchange differences) at 4.0 release, even if the exchanges themselves aren't supported yet. |
I also noticed that it's difficult for me to take balances from wallet to get it to work in engine.js, as Bitfinex wallets have available amount and GDAX wallet has hold amount. I know that it is possible to take and make some mathematics to get correct values, but I want a simpler way because of my limited knowledge in coding. P.S. Some comments in code would be of great help to know what is what ;) |
I think this would work:
|
Something like this should do for the buy(sell: ` buy: function (opts, cb) sell: function (opts, cb) For a more complete example, I would do something like this (for Bitstamp). I don't know if it will work yet. I may have problems with the callbacks and error handling: buy: function (opts, cb) {
var client = authedClient()
if (typeof opts.type === 'undefined' ) {
opts.type = limit
}
if (opts.type === 'limit') {
var limit_price = opts.price // Fix me
// GDAX client.buy(opts, function (err, resp, body) {
client.buy(opts.product_id, opts.size, opts.price, limit_price, function (err, resp, body) {
if (!err) err = statusErr(resp, body)
if (err) return cb(err)
cb(null, body)
})
} else {
// GDAX client.buy(opts, function (err, resp, body) {
client.buyMarket(opts.product_id, opts.size, function (err, resp, body) {
if (!err) err = statusErr(resp, body)
if (err) return cb(err)
cb(null, body)
})
}
}, |
I end up with: |
Uploaded files. Created pull request. |
Completed Bitfinex extension support. Looks like everything working except backfilling. Please, check pull request. |
OK. Currently testing, to see any errors in trading. Backfill is not supported. If this extension will work as intended, next step is to add it via https://cryptowat.ch/ API. |
I started it a few minutes ago. |
After starting trade in papertrading mode, this shows up every now and then:
|
Sorry. My mistake on sell. Corrected. |
Still same message! |
@EigilB pull and restart |
@nedievas Have pulled after update. It is still happening |
@EigilB show me from the beginning: |
The problem is when I ctrl-z, my paper trading balance resets to default :( The same is on default GDAX. |
Then it repeats |
@EigilB I suppose you've got an API block. |
I prepared the extension to add Bitfinex to upcoming version, but I see that it will be necessary to change engine.js for it to work.
The text was updated successfully, but these errors were encountered: