bourso-api
bourso-api copied to clipboard
feat: bourso-cli trade position list
theobontemps@MacBookPro bourso-api % ./target/debug/bourso-cli trade -h
Trade with your accounts
Usage: bourso-cli trade <COMMAND>
Commands:
order
position Manage your positions in your trading account
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
theobontemps@MacBookPro bourso-api % ./target/debug/bourso-cli trade position -h
Manage your positions in your trading account
Usage: bourso-cli trade position <COMMAND>
Commands:
list List all your positions in your trading account
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
theobontemps@MacBookPro bourso-api % ./target/debug/bourso-cli trade position list -h
List all your positions in your trading account
Usage: bourso-cli trade position list --account <account>
Options:
-a, --account <account> The account to use by its 'id' (e.g: 'e51f635524a7d506e4d4a7a8088b6278').
You can get this info with the command `bourso accounts` [default: PEA]
-h, --help Print help
theobontemps@MacBookPro bourso-api % ./target/debug/bourso-cli trade position list --account e51f635524a7d506e4d4a7a8088b6278
INFO bourso_cli > Welcome to BoursoBank CLI đ
INFO bourso_cli > âšī¸ - Version 0.2.0. Make sure you're running the latest version: https://github.com/azerpas/bourso-api
INFO bourso_cli > We'll try to log you in with your customer id: 12345678
INFO bourso_cli > If you want to change it, run `bourso config --username <customer_id>`
INFO bourso_cli > We'll need your password to log you in. It will not be stored anywhere and will be asked everytime you run a command. The password will be hidden while typing.
Enter your password:
INFO bourso_api::client > đ You are now logged in with user: 4d4a7a8088b6278
INFO bourso_cli > Login successful â
INFO bourso_cli > Found 1 positions
INFO bourso_cli > Symbol: BNPP S&P500EUR ETF (1rTESE), Quantity: 123, Amount: 12345.67 EUR
Hey @theo-bnts, thanks a lot for your contribution!
Could you please leave a comment or modify the PR description to explain the feature and what it does?
Also, could you please update the version to 0.3.0 in cargo.toml, thanks :)
Hi,
My little participation on this nice feature. The total positions are false.
It's give me 2 positions instead of the 6 positions I have.
I apply this quick fix, and it's now OK.
let total_positions = summary
.iter()
.map(|item| item.positions.as_ref().map_or(0, |p| p.len()))
.sum::<usize>();
info!("Found {} positions", total_positions);