twstock 0.1.0

API binding for fetching data from the Taiwan Stock Exchange (TWSE)
Documentation

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 support
  • native-tls: Use the native-tls backend
  • native-tls-vendored: Use the native-tls backend with vendored OpenSSL
  • rustls-tls: Use the rustls backend

Don't forget to disable default features if you want to use a specific TLS backend.