tastytrade-rs
Rust library for stock market trading through tastytrade's API. Very much work in progress. See tastytrade-cli for an example of a more involved application using this library.
Example
let tasty = login
.await
.unwrap;
let account = tasty.account
.await
.unwrap
.unwrap;
println!;
println!;
println!;
let order_leg = default
.instrument_type
.symbol
.quantity
.action
.build
.unwrap;
let order = default
.time_in_force
.order_type
.price
.price_effect
.legs
.build
.unwrap;
let dry_result = account.dry_run.await;
println!;
// Outputs:
// DryRunResult {
// order: DryRunRecord {
// account_number: AccountNumber(
// "ABC12345",
// ),
// time_in_force: GTC,
// order_type: Limit,
// size: 1,
// underlying_symbol: Symbol(
// "AAPL",
// ),
// price: 170.0,
// price_effect: Debit,
// status: Received,
// cancellable: true,
// editable: true,
// edited: false,
// legs: [
// OrderLeg {
// instrument_type: Equity,
// symbol: Symbol(
// "AAPL",
// ),
// quantity: 1,
// action: BuyToOpen,
// },
// ],
// },
// warnings: [],
// buying_power_effect: BuyingPowerEffect {
// change_in_margin_requirement: 85.0,
// change_in_margin_requirement_effect: Debit,
// change_in_buying_power: 85.001,
// change_in_buying_power_effect: Debit,
// current_buying_power: 562.5,
// current_buying_power_effect: Credit,
// impact: 85.001,
// effect: Debit,
// },
// fee_calculation: FeeCalculation {
// total_fees: 0.001,
// total_fees_effect: Debit,
// },
// },