Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Dec 14, 2023
2 parents 63d4d6d + 8e4f034 commit 8c56e21
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 31 deletions.
2 changes: 1 addition & 1 deletion c/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "longport-c"
version = "1.0.4"
version = "1.0.5"
description = "LongPort OpenAPI SDK for C"
homepage = "https://open.longportapp.com/en/"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion c/crates/macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "longport-c-macros"
version = "1.0.4"
version = "1.0.5"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion c/src/quote_context/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ pub unsafe extern "C" fn lb_quote_context_calc_indexes(
let ctx_inner = (*ctx).ctx.clone();
let symbols = cstr_array_to_rust(symbols, num_symbols);
let indexes = std::slice::from_raw_parts(indexes, num_indexes)
.into_iter()
.iter()
.map(|index| (*index).into());
execute_async(callback, ctx, userdata, async move {
let resp: CVec<CSecurityCalcIndexOwned> =
Expand Down
1 change: 1 addition & 0 deletions c/src/quote_context/enum_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ pub enum CSecuritiesUpdateMode {
/// Calc index
#[derive(Debug, Copy, Clone, Eq, PartialEq, CEnum)]
#[c(remote = "longport::quote::CalcIndex")]
#[allow(clippy::enum_variant_names)]
#[repr(C)]
pub enum CCalcIndex {
/// Latest price
Expand Down
2 changes: 1 addition & 1 deletion java/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "longport-java"
version = "1.0.4"
version = "1.0.5"

[lib]
crate-type = ["cdylib"]
Expand Down
2 changes: 1 addition & 1 deletion java/crates/macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "longport-java-macros"
version = "1.0.4"
version = "1.0.5"
edition = "2021"

[lib]
Expand Down
6 changes: 3 additions & 3 deletions nodejs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "longport-nodejs"
version = "1.0.4"
version = "1.0.5"

[lib]
crate-type = ["cdylib"]
Expand All @@ -10,13 +10,13 @@ crate-type = ["cdylib"]
longport = { path = "../rust" }
longport-nodejs-macros = { path = "crates/macros" }

napi = { version = "2.12.3", default-features = false, features = [
napi = { version = "2.14.1", default-features = false, features = [
"napi4",
"chrono_date",
"async",
"serde-json",
] }
napi-derive = "2.12.3"
napi-derive = "2.14.1"
rust_decimal = { version = "1.23.1", features = ["maths"] }
chrono = "0.4.19"
time = { version = "0.3.9", features = ["macros", "formatting"] }
Expand Down
2 changes: 1 addition & 1 deletion nodejs/crates/macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "longport-nodejs-macros"
version = "1.0.4"
version = "1.0.5"
edition = "2021"

[lib]
Expand Down
3 changes: 1 addition & 2 deletions nodejs/src/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ macro_rules! decimal_constants {
#[napi_derive::napi]
impl Decimal {
$(
#[napi(factory)]
#[napi(js_name = $name)]
#[napi(factory, js_name = $name)]
#[allow(non_snake_case)]
#[inline]
pub fn $id() -> Self {
Expand Down
1 change: 0 additions & 1 deletion nodejs/src/quote/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use chrono::{DateTime, Utc};
use longport::quote::SubFlags;
use longport_nodejs_macros::{JsEnum, JsObject};
use napi::bindgen_prelude::*;

use crate::{
decimal::Decimal,
Expand Down
1 change: 0 additions & 1 deletion nodejs/src/trade/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use chrono::{DateTime, Utc};
use longport_nodejs_macros::{JsEnum, JsObject};
use napi::bindgen_prelude::*;

use crate::{decimal::Decimal, time::NaiveDate, types::Market};

Expand Down
1 change: 0 additions & 1 deletion nodejs/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use longport_nodejs_macros::JsEnum;
use napi::bindgen_prelude::*;

#[napi_derive::napi]
#[derive(Debug, JsEnum, Hash, Eq, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion nodejs/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use time::OffsetDateTime;
pub(crate) type JsCallback<T> = ThreadsafeFunction<T, ErrorStrategy::CalleeHandled>;

pub(crate) fn to_datetime(time: OffsetDateTime) -> DateTime<Utc> {
DateTime::from_utc(
DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(time.unix_timestamp(), 0).unwrap(),
Utc,
)
Expand Down
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "longport-python"
version = "1.0.4"
version = "1.0.5"
description = "LongPort OpenAPI SDK for Python"
homepage = "https://open.longportapp.com/en/"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion python/crates/macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "longport-python-macros"
version = "1.0.4"
version = "1.0.5"
edition = "2021"

[lib]
Expand Down
7 changes: 5 additions & 2 deletions python/pysrc/longport/openapi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,12 @@ class Config:
"""
Gets a new `access_token`
`expired_at` - The expiration time of the access token, defaults to `90` days.
"""
Args:
expired_at: The expiration time of the access token, defaults to `90` days.
Returns:
Access token
"""

class Language:
"""
Expand Down
10 changes: 5 additions & 5 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "longport"
version = "1.0.4"
version = "1.0.5"
description = "LongPort OpenAPI SDK for Rust"
homepage = "https://open.longportapp.com/en/"
readme = "README.md"
Expand All @@ -14,10 +14,10 @@ categories = ["api-bindings"]
blocking = ["flume"]

[dependencies]
longport-wscli = { path = "crates/wsclient", version = "1.0.4" }
longport-httpcli = { path = "crates/httpclient", version = "1.0.4" }
longport-proto = { path = "crates/proto", version = "1.0.4" }
longport-candlesticks = { path = "crates/candlesticks", version = "1.0.4" }
longport-wscli = { path = "crates/wsclient", version = "1.0.5" }
longport-httpcli = { path = "crates/httpclient", version = "1.0.5" }
longport-proto = { path = "crates/proto", version = "1.0.5" }
longport-candlesticks = { path = "crates/candlesticks", version = "1.0.5" }

tokio = { version = "1.18.2", features = [
"time",
Expand Down
2 changes: 1 addition & 1 deletion rust/crates/candlesticks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "longport-candlesticks"
version = "1.0.4"
version = "1.0.5"
description = "LongPort candlestick utils for Rust"
license = "MIT OR Apache-2.0"

Expand Down
2 changes: 1 addition & 1 deletion rust/crates/httpclient/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "longport-httpcli"
version = "1.0.4"
version = "1.0.5"
description = "LongPort HTTP SDK for Rust"
license = "MIT OR Apache-2.0"

Expand Down
2 changes: 1 addition & 1 deletion rust/crates/proto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "longport-proto"
version = "1.0.4"
version = "1.0.5"
description = "LongPort Protocol"
license = "MIT OR Apache-2.0"

Expand Down
4 changes: 2 additions & 2 deletions rust/crates/wsclient/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "longport-wscli"
version = "1.0.4"
version = "1.0.5"
edition = "2021"
description = "LongPort Websocket SDK for Rust"
license = "MIT OR Apache-2.0"

[dependencies]
longport-proto = { path = "../proto", version = "1.0.4" }
longport-proto = { path = "../proto", version = "1.0.5" }

tokio = { version = "1.18.2", features = [
"time",
Expand Down
14 changes: 12 additions & 2 deletions rust/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,18 @@ impl Config {
) -> Self {
Self {
http_cli_config: HttpClientConfig::new(app_key, app_secret, access_token),
quote_ws_url: QUOTE_WS_URL.to_string(),
trade_ws_url: TRADE_WS_URL.to_string(),
quote_ws_url: if is_cn() {
CN_QUOTE_WS_URL
} else {
QUOTE_WS_URL
}
.to_string(),
trade_ws_url: if is_cn() {
CN_TRADE_WS_URL
} else {
TRADE_WS_URL
}
.to_string(),
language: Language::EN,
}
}
Expand Down

0 comments on commit 8c56e21

Please sign in to comment.