Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad string type in sold-assets.json #4

Closed
daddywookie opened this issue May 18, 2021 · 2 comments
Closed

Bad string type in sold-assets.json #4

daddywookie opened this issue May 18, 2021 · 2 comments

Comments

@daddywookie
Copy link

  • The sell_at key is returned as a text when it should be numeric
  • The profit key is a text with the % symbol. Should this be a simple numeric and leave the text formatting to the front end
@21jake
Copy link
Owner

21jake commented May 19, 2021

This is a sold-assets.json

[
    {
        "symbol": "XRPUSDT",
        "quantity": 23.4,
        "orderId": 8106,
        "bought_at": 0.98,
        "TP_Threshold": 1.113,
        "SL_Threshold": 1.0185,
        "purchase_time": "5/19/2021, 1:54:53 PM",
        "updated_at": "5/19/2021, 1:57:40 PM",
        "sell_time": "5/19/2021, 1:58:43 PM",
        "sell_at": 1.01,
        "profit": "3.06%"
    }
]

The sell_at key is numeric by default, don't really know why you got it as string type. Anyway I coerced its type just to make sure.
The profit key is formatted with the "%" on purpose, so users can easily see the profit in percentage without extra calculation. I believe the front end could easily calculate the value with the bought_at and sell_at value.

@daddywookie
Copy link
Author

Good point on the profit percentage. Easy enough to work around. The sell_at being numeric I'll confirm once I fire up the script again today.

21jake added a commit that referenced this issue May 19, 2021
- coerce sell_at type as Number, just to make sure.
- If we're using Testnet, even if the order marked as "EXPIRED" or whatever, we pretend that's a success order and proceed the next actions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants