Skip to content
New issue

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

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

Already on GitHub? # to your account

Incorrect values in view["stat"]["funds"] record #124

Closed
Tim55667757 opened this issue Feb 14, 2023 · 1 comment
Closed

Incorrect values in view["stat"]["funds"] record #124

Tim55667757 opened this issue Feb 14, 2023 · 1 comment
Assignees
Labels
Error It's a BUG! Or just something isn't working...
Milestone

Comments

@Tim55667757
Copy link
Owner

Bug in this code:

                    # e.g. {"rub": {"total": 10000.99, "totalCostRUB": 10000.99, "free": 1234.56, "freeCostRUB": 1234.56}, "usd": {"total": 250.55, "totalCostRUB": 15375.80, "free": 125.05, "freeCostRUB": 7687.50}}
                    view["stat"]["funds"][currency] = {
                        "total": volume,
                        "totalCostRUB": costRUB,  # total volume cost in rubles
                        "free": volume - blocked,
                        "freeCostRUB": costRUB * ((volume - blocked) / volume) if volume > 0 else 0,  # free volume cost in rubles
                    }

Incorrect result:

    "_funds": {
        "usd": {
            "total": 0.34,
            "totalCostRUB": 73.78,
            "free": 0.34,
            "freeCostRUB": 73.78
        },
        "rub": {
            "total": 163168.29,
            "totalCostRUB": 163168.29,
            "free": 163168.29,
            "freeCostRUB": 163168.29
        },
        "eur": {
            "total": 0.22,
            "totalCostRUB": 79.26,
            "free": 0.22,
            "freeCostRUB": 79.26
        },
        "hkd": {
            "total": 17006.5,
            "totalCostRUB": 9.55,
            "free": 17000.29,
            "freeCostRUB": 9.55
        }
    }
@Tim55667757 Tim55667757 added the Error It's a BUG! Or just something isn't working... label Feb 14, 2023
@Tim55667757 Tim55667757 added this to the release-1.6 milestone Feb 14, 2023
@Tim55667757 Tim55667757 self-assigned this Feb 14, 2023
@Tim55667757 Tim55667757 reopened this Feb 15, 2023
Tim55667757 added a commit that referenced this issue Feb 15, 2023
@Tim55667757
Copy link
Owner Author

Oh, it seems be good now:

image

Fixed in build v1.6.dev151

Debug build: https://app.travis-ci.com/github/Tim55667757/TKSBrokerAPI/builds/260670872
PyPI artefact for testing: https://pypi.org/project/tksbrokerapi/1.6.dev151/

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Error It's a BUG! Or just something isn't working...
Projects
None yet
Development

No branches or pull requests

1 participant