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

Fix to Binance dates appearing incorrect in Roundtrip info #1846

Merged
merged 4 commits into from
Feb 3, 2018
Merged

Fix to Binance dates appearing incorrect in Roundtrip info #1846

merged 4 commits into from
Feb 3, 2018

Conversation

rkingy
Copy link
Contributor

@rkingy rkingy commented Feb 2, 2018

Was trying to pass a millisecconds Unix timestamp with the moment.unix() function, when we just need to pass it straight in. This was causing dates in the Rountrips table to appear like 50046-01-30

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    Fixes random roundtrip dates on binance

  • What is the current behavior? (You can also link to an open issue here)
    Rountrips table dates appear like 50046-01-30

  • What is the new behavior (if this is a feature change)?
    The correct dates are shown

  • Other information:
    Issue documented here Binance: Rountrip entry and exit dates are broken #1687

Was trying to pass a millisecconds Unix timestamp with the moment.unix() function, when we just need to pass it straight in. This was causing dates in the Rountrips table to appear like 50046-01-30
@@ -255,7 +255,10 @@ Trader.prototype.getOrder = function(order, callback) {

var price = parseFloat(data.price);
var amount = parseFloat(data.executedQty);
var date = moment.unix(data.time);

//Data.time is a 13 digit millisecon unix time stamp.
Copy link
Contributor

Choose a reason for hiding this comment

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

space after //

var date = moment.unix(data.time);

//Data.time is a 13 digit millisecon unix time stamp.
//https://momentjs.com/docs/#/parsing/unix-timestamp-milliseconds/
Copy link
Contributor

Choose a reason for hiding this comment

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

space after //

@askmike
Copy link
Owner

askmike commented Feb 3, 2018

Awesome stuff, thanks!

Can you look at the comments by @greenbigfrog, also the DEMA fix (see #1812) is about to be merged (making your script redundant), can you remove yours?

@rkingy
Copy link
Contributor Author

rkingy commented Feb 3, 2018

@askmike No problem, all done.

@askmike
Copy link
Owner

askmike commented Feb 3, 2018

👍 Thanks :)

@askmike askmike merged commit d0f94cb into askmike:develop Feb 3, 2018
@greenbigfrog
Copy link
Contributor

@askmike Should there rly be revert commits for commits introduced inside the same PR be included afterwards? IMO the history should just be rewritten, resulting to a lot less commits per PR (still have completely separate stuff in separate commits though)

@askmike
Copy link
Owner

askmike commented Feb 3, 2018

@greenbigfrog normally when the change is small I do merge all of these myself in a single "squash merge commit", however I forgot to do so for this PR. I don't feel comfortable doing it now on the live develop branch as I now a lot of people are using that branch.

I will definitely keep a better watch for future PRs.

Other projects (like bitcoin) have the policy of always doing squash merge commits for every PR, I am not sure if Gekko is there yet as this does mean you lose a lot of git history with bigger PRs.

@Erasss
Copy link

Erasss commented Feb 5, 2018

when changed date type in binance.js, does not trade anymore and process dies with error:
(ERROR): [binance.js] (addOrder) returned an irrecoverable error: undefined
2018-02-04 18:12:50 (DEBUG): [binance.js] entering "setOrder" callback after api call, err: [binance.js] undefined data: {"code":-1013,"msg":"Filter failure: PRICE_FILTER"}

@rkingy
Copy link
Contributor Author

rkingy commented Feb 6, 2018

@Erasss What branch are you on and what is your most recent commit you have?
Did was there any other error messages than the above?

@Erasss
Copy link

Erasss commented Feb 6, 2018

No other errors, i used stable version, changed date to unix now working trading.

@Erasss
Copy link

Erasss commented Feb 6, 2018

Detail logs, and then child dead:
2018-02-04 18:12:49 (DEBUG): [binance.js] entering "setBalance" callback after api call, err: null, data: [object Object]
2018-02-04 18:12:49 (INFO): Attempting to BUY 0.31920354543580637 NEO at binance price: 0.126128
2018-02-04 18:12:49 (DEBUG): [binance.js] (addOrder) BUY 0.31 NEO @0.12612799 ETH
2018-02-04 18:12:50 (ERROR): [binance.js] (addOrder) returned an irrecoverable error: undefined
2018-02-04 18:12:50 (DEBUG): [binance.js] entering "setOrder" callback after api call, err: [binance.js] undefined data: {"code":-1013,"msg":"Filter failure: PRICE_FILTER"}

@Erasss
Copy link

Erasss commented Feb 7, 2018

Its problem from price precision, not date. Received again in stable version

@rkingy
Copy link
Contributor Author

rkingy commented Feb 8, 2018

@Erasss Yeah this is unrelated to the issue here..

Binance has recently changed the min buy amounts. The updates for this are on the develop branch and aren't on stable yet. But if you want to stay on stable you can update these values yourself.

Have a look in the /exchanges/binance.js
You want to change this..
{
pair: ['ETH', 'NEO'],
minimalOrder: { amount: 0.01, unit: 'asset' },
precision: 0.00000001,
},

to be
{
pair: ['ETH', 'NEO'],
minimalOrder: { amount: 0.01, unit: 'asset' },
precision: 0.000001,
},

Give that a go..

@Erasss
Copy link

Erasss commented Feb 8, 2018

Yes, i changed allready Thanks

This was referenced Mar 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants