# Chinese/Asian Broker SDK Comparison

## LongPort (长桥) vs Snowball Securities (雪盈)

| Feature | LongPort (`longbridge`) | Snowball (`snbpy`) |
|---|---|---|
| **CLI Tool** | ✅ `longport-cli` | ❌ None |
| **Python SDK** | ✅ `longbridge` (PyPI) | ✅ `snbpy` (PyPI) |
| **Java SDK** | ✅ | ✅ |
| **Market Data API** | ✅ Realtime, K-lines, depth, options chain | ❌ No market data |
| **Trading API** | ✅ Full (limit/market/stop/trailing) | ✅ 10 APIs |
| **Watchlist API** | ✅ | ❌ |
| **Fundamentals** | ✅ PE/PB/EPS/BPS/dividend yield | ❌ |
| **Capital Flow** | ✅ | ❌ |
| **Active Maintenance** | ✅ Regular updates | ⚠️ Last updated ~2021 |
| **Market Coverage** | HK, US, CN, SG | HK, US (+ forex, futures, options, bonds) |
| **GitHub Stars** | ~hundreds | 35 |

## Snowball Securities (`snbpy`) Details

### Install
```bash
pip install snbpy
```

### 10 Core APIs
| Method | Description |
|---|---|
| `login` | Get auth token |
| `get_token_status` | Check token expiry |
| `place_order` | Submit order |
| `cancel_order` | Cancel order |
| `get_order_by_id` | Query single order |
| `get_order_list` | Query all orders |
| `get_position_list` | Query holdings |
| `get_balance` | Query account balance |
| `get_security_detail` | Security info |
| `get_transaction_list` | Query trade history |

### Supported Order Types
Limit, Market, Stop, Stop Limit, Trailing, Market-on-Open, Limit-on-Open, Market-on-Close, Limit-on-Close

### Supported Asset Types
Stocks (STK), Futures (FUT), Options (OPT), Warrants (WAR), CFDs, Forex (CASH), Bonds, Funds, CBBCs (IOPT)

### Configuration
```python
from snbpy.common.domain.snb_config import SnbConfig
from snbpy.snb_api_client import SnbHttpClient

config = SnbConfig()
config.account = "DU876752"  # Your account ID
config.key = 'your_secret_key'
config.snb_server = 'openapi.snbsecurities.com'  # prod
config.snb_port = '443'
config.schema = 'https'
config.timeout = 1000

client = SnbHttpClient(config)
client.login()
```

### Environments
| Env | URL | Account |
|---|---|---|
| SIT (test) | sandbox.snbsecurities.com | Contact support |
| PROD (real) | openapi.snbsecurities.com | Self-register on website |

### Key Limitations
- **No market data** — cannot get quotes, K-lines, or depth
- **No CLI** — Python/Java SDK only
- **Stale** — last PyPI release ~2021, no recent commits
- **Token limit** — server keeps max 10 tokens per user

### GitHub
https://github.com/snowballsecurities/snbpy (35 stars, MIT license)

### Docs
https://snowballsecurities.github.io/

## When to Use Which
- **LongPort**: Primary choice for everything — data, trading, analysis
- **Snowball**: Only if you have a Snowball account and want to automate trades there. Use LongPort for all market data regardless.
