|
1 | | -# tradee |
| 1 | +# Tradee |
2 | 2 |
|
3 | | -A new Flutter project. |
| 3 | +A client-side crypto options trading simulator built with Flutter. Practice options trading with real-time market data, Black-Scholes pricing, and professional-grade risk analytics — no backend, no real money, no sign-up. |
4 | 4 |
|
5 | | -## Getting Started |
| 5 | +**[Try it live](https://harsh159357.github.io/Tradee/)** |
6 | 6 |
|
7 | | -This project is a starting point for a Flutter application. |
| 7 | +## What It Does |
8 | 8 |
|
9 | | -A few resources to get you started if this is your first Flutter project: |
| 9 | +Tradee simulates a professional crypto options exchange (think Deribit / Binance Options) entirely on the client side. It connects to live Binance WebSocket feeds for real-time spot prices and generates a full options chain with realistic pricing, spreads, and risk metrics. |
10 | 10 |
|
11 | | -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) |
12 | | -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) |
| 11 | +- **Real-time spot prices** via Binance WebSocket (BTC, ETH, SOL) |
| 12 | +- **Black-Scholes pricing** with Greeks (Delta, Gamma, Vega, Theta) |
| 13 | +- **Dynamic IV** with skew modeling and rolling realized volatility |
| 14 | +- **Market & limit orders** with bid-ask spreads and slippage simulation |
| 15 | +- **Portfolio tracking** with live mark-to-market P&L |
| 16 | +- **Risk dashboard** with net Greeks and stress-test scenarios |
| 17 | +- **Strategy builder** with payoff diagrams and max profit/loss |
| 18 | +- **Daily expiry cycle** — positions auto-settle at 23:59:59 UTC |
13 | 19 |
|
14 | | -For help getting started with Flutter development, view the |
15 | | -[online documentation](https://docs.flutter.dev/), which offers tutorials, |
16 | | -samples, guidance on mobile development, and a full API reference. |
| 20 | +## Screens |
| 21 | + |
| 22 | +| Markets | Trading | Portfolio | Risk | Strategy | Settings | |
| 23 | +|---------|---------|-----------|------|----------|----------| |
| 24 | +| Asset selector with live spot prices and 24h change | Options chain with calls/puts, tap to trade | Open positions, balance, margin usage, close trades | Net Greeks, stressed P&L, margin status | Multi-leg builder with payoff chart | Reset account, volatility mode toggle | |
| 25 | + |
| 26 | +## Architecture |
| 27 | + |
| 28 | +``` |
| 29 | +lib/ |
| 30 | +├── core/ Constants, routing |
| 31 | +├── domain/ Pure Dart models (Position, OptionContract, MarginStatus) |
| 32 | +├── engines/ Stateless computation (Black-Scholes, volatility, margin, spreads, time) |
| 33 | +├── data/ WebSocket + REST market data, Hive storage |
| 34 | +├── features/ Riverpod state management |
| 35 | +├── ui/ Screens and widgets (zero business logic) |
| 36 | +└── main.dart App entry, liquidation & expiry listeners |
| 37 | +``` |
| 38 | + |
| 39 | +**Key design choices:** |
| 40 | +- Clean architecture — engines are pure Dart, stateless, and unit-tested |
| 41 | +- No business logic in UI widgets |
| 42 | +- Riverpod for state management with hooks |
| 43 | +- `compute()` for chain generation (isolate on native, main-thread on web) |
| 44 | +- Hive for local persistence (survives app restart) |
| 45 | +- WebSocket with auto-reconnect, heartbeat monitoring, and REST fallback |
| 46 | + |
| 47 | +## How It Works |
| 48 | + |
| 49 | +**Pricing:** Each option is priced using Black-Scholes with inputs from the volatility engine (rolling 1h realized vol with OTM skew). Strikes are generated dynamically around the current spot price. |
| 50 | + |
| 51 | +**Orders:** Market orders fill instantly at bid/ask. Limit orders fill when the mark price crosses the limit. Spreads widen with volatility. Slippage scales with order size. |
| 52 | + |
| 53 | +**Risk:** Long options require premium as margin. Short options use stress-tested margin (spot +/-5%). If equity drops below maintenance margin, all positions are force-liquidated at worst bid/ask. |
| 54 | + |
| 55 | +**Expiry:** All options are European, same-day expiry at 23:59:59 UTC. At expiry, positions settle at intrinsic value. The account resets to $100,000 daily. |
| 56 | + |
| 57 | +## Run Locally |
| 58 | + |
| 59 | +```bash |
| 60 | +# Mobile |
| 61 | +flutter run |
| 62 | + |
| 63 | +# Web |
| 64 | +flutter run -d chrome |
| 65 | + |
| 66 | +# Build for web |
| 67 | +flutter build web --release --base-href="/Tradee/" |
| 68 | +``` |
| 69 | + |
| 70 | +Requires Flutter SDK (stable channel). |
| 71 | + |
| 72 | +## Tech Stack |
| 73 | + |
| 74 | +- **Flutter** — cross-platform UI (iOS, Android, Web) |
| 75 | +- **Riverpod + Hooks** — reactive state management |
| 76 | +- **go_router** — declarative routing |
| 77 | +- **Hive** — lightweight local storage |
| 78 | +- **web_socket_channel** — Binance WebSocket feed |
| 79 | +- **Black-Scholes** — options pricing model (custom implementation) |
| 80 | + |
| 81 | +## License |
| 82 | + |
| 83 | +This project is for educational and demonstration purposes only. Not financial advice. No real trading occurs. |
0 commit comments