bourso-api icon indicating copy to clipboard operation
bourso-api copied to clipboard

feat: bourso-cli trade position list

Open theo-bnts opened this issue 5 months ago â€ĸ 2 comments

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

theo-bnts avatar Jul 13 '25 14:07 theo-bnts

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 :)

azerpas avatar Jul 16 '25 19:07 azerpas

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);

dsegurakaliop avatar Jul 23 '25 03:07 dsegurakaliop