Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Implement Backfill bitfinex with APIv2 & refactoring err.match function #276

Closed
wants to merge 5 commits into from

Conversation

nao0811ta
Copy link

@nao0811ta nao0811ta commented Jun 12, 2017

fixed #257

@nao0811ta nao0811ta changed the title Backfill bitfinex with v2 && refactoring err.match function Backfill bitfinex with v2 & refactoring err.match function Jun 12, 2017
@nao0811ta nao0811ta changed the title Backfill bitfinex with v2 & refactoring err.match function Implement Backfill bitfinex with v2 & refactoring err.match function Jun 12, 2017
@nao0811ta nao0811ta changed the title Implement Backfill bitfinex with v2 & refactoring err.match function Implement Backfill bitfinex with APIv2 & refactoring err.match function Jun 12, 2017
@@ -66,13 +66,22 @@ module.exports = function container (get, set, clear) {
var opts = {product_id: product_id}
if (mode === 'backward') {
opts.to = marker.from
// bitfinex v2 api required timestamp
if (exchange_id === 'bitfinex' && !marker.from){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will really need to find a different solution for this, logic for exchanges should be limited to exchanges, and never live outside of that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you
if opts.to is null , bitfinex response 1 years ago data.
hm.. I'm thinking..

exchange.getTrades(opts, function (err, trades) {
var tradeFunc = 'getTrades'
// for bitfinex v2 api for support historical api
if (exchange_id === 'bitfinex'){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before: this logic should happen in the exchange.js

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it..

function joinProduct (product_id) {
return product_id.split('-')[0] + '' + product_id.split('-')[1]
}

// symbol for v2
function joinProduct2 (product_id) {
return 't' + product_id.split('-')[0] + '' + product_id.split('-')[1]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just return 't' + joinProduct(product_id)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that. I forget to fix.

}
if (opts.to) {
// started point
args.end = opts.to
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the commands you are setting this to new Date().getTime(), why not just do that here?

@DeviaVir
Copy link
Owner

I also think there must be a nicer way than to use function2 for the v2 things, maybe they should just live in different class?

@nao0811ta
Copy link
Author

@DeviaVir
I'm sorry. and thank you, it must create new v2 class. but I don't have many time to survey v2 new API. so I only implemented backfill function for me ASAP. So, I hope that helps someone.
@nedievas

@nao0811ta nao0811ta closed this Jun 13, 2017
@nao0811ta
Copy link
Author

@nedievas is working for v2
and my implementation is bad
so close PR.

@nao0811ta nao0811ta reopened this Jun 13, 2017
@nao0811ta nao0811ta closed this Jun 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants