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

TradeRoutines: implement CalculateLotsForDeal() method #111

Closed
Tim55667757 opened this issue Dec 6, 2022 · 1 comment
Closed

TradeRoutines: implement CalculateLotsForDeal() method #111

Tim55667757 opened this issue Dec 6, 2022 · 1 comment
Assignees
Labels
Feature New feature, request or an idea
Milestone

Comments

@Tim55667757
Copy link
Owner

Tim55667757 commented Dec 6, 2022

CalculateLotsForDeal() method calculates maximum lots for deal depends on current price and volume of instrument in one lot.

Formula: lots = maxCost // (currentPrice * volumeInLot), it means max count of lots, for which will be:
cost = lots * currentPrice * volumeInLot <= maxCost.

If costOneLot = currentPrice * volumeInLot > maxCost, then returned lots = 1.

If an error occurred then returned lots = 0.

This method can be used when you need to calculate lots to open position.

@Tim55667757 Tim55667757 self-assigned this Dec 6, 2022
@Tim55667757 Tim55667757 added the Task A small task or improvements label Dec 6, 2022
@Tim55667757 Tim55667757 added this to the release-1.6 milestone Dec 6, 2022
Tim55667757 added a commit that referenced this issue Dec 7, 2022
Tim55667757 added a commit that referenced this issue Dec 7, 2022
@Tim55667757
Copy link
Owner Author

Implemented since build v1.6.dev134

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

@Tim55667757 Tim55667757 added Feature New feature, request or an idea and removed Task A small task or improvements labels Dec 23, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Feature New feature, request or an idea
Projects
None yet
Development

No branches or pull requests

1 participant