Expand description
§Taiwan Stock Exchange (TWSE) API
twstock is a library for fetching data from the Taiwan Stock Exchange (TWSE) API.
Behind the scenes, it uses the reqwest crate to make HTTP requests to their server.
§Example:
use twstock::*;
async fn fetch() {
let client = Client::new();
match client
.realtime()
.fetch(Stock {
kind: StockKind::Live,
code: 2330,
})
.await
{
Ok(x) => assert_eq!(x.name, "台積電"),
Err(err) => match err {
Error::MarketClosed => {}
_ => panic!("unexpected error: {:?}", err),
},
};
}§Features:
serde: Enable serde supportnative-tls: Use the native-tls backendnative-tls-vendored: Use the native-tls backend with vendored OpenSSLrustls-tls: Use the rustls backend
Don’t forget to disable default features if you want to use a specific TLS backend.
Modules§
Structs§
- Client
- Client for fetching data from the Taiwan Stock Exchange (TWSE) API
- Stock
- Stock identifier and its variant