Skip to content

Add base currency conversion for positions and portfolio with cross-pair support #3061

@bmlquant

Description

@bmlquant

Feature Request

implement functionality for currency (including crypto) conversion into base currency (configurable)

Problem Statement

in forex/crypto trading it is always important to convert positions/balances into base currency, lets say USD. It is especially useful when have crosses position, i.e. EUR/GBP or ETH/BTC but your accounting/base currency is USD
What problem are you trying to solve? What limitations exist in the current implementation?

Proposed Solution

add function to Instrument, Portfolio, Position to accept target currency and price(s) to use in the conversion and output result in target currency. It is very similar to notional = position.notional_value(current_price) just instead of assuming target currency allow to specify. Attention: for crosses you need two set of prices, so perhaps have two functions, one for non-cross and second for cross with different signatures
Detailed description of the feature you'd like to see implemented.

Example Usage

position.notional_value(current_price, target_currency:'USD')
position.cross_notional_value(current_quote_price, current_base_price, target_currency:'USD')

# Show how the feature would be used

Alternatives Considered

doing it in custom code, but this is generic problem for everyone trading currencies
What alternatives have you explored? Why is this solution preferred?

Additional Context

Any other relevant information or references.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions