Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ jobs:
uses: lukka/get-cmake@latest

- name: Install cargo make
run: cargo install cargo-make
uses: taiki-e/install-action@v2
with:
tool: cargo-make

- name: Check with clippy
run: cargo clippy -p longbridge-c --all-features
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ jobs:
uses: lukka/get-cmake@latest

- name: Install cargo make
run: cargo install cargo-make
uses: taiki-e/install-action@v2
with:
tool: cargo-make

- name: Build
if: ${{ matrix.settings.target != 'aarch64-apple-darwin' }}
Expand Down Expand Up @@ -348,7 +350,9 @@ jobs:
uses: lukka/get-cmake@latest

- name: Install cargo make
run: cargo install cargo-make
uses: taiki-e/install-action@v2
with:
tool: cargo-make

- name: Build
if: ${{ matrix.settings.target != 'aarch64-apple-darwin' }}
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.3.1] - 2026-06-12

### Added

- **All languages:** `FundamentalContext` gains `macroeconomic_indicators(country, offset, limit)` — list macroeconomic indicators via `GET /v1/quote/macrodata`; filter by country (`MacroeconomicCountry::HongKong / China / UnitedStates / EuroZone / Japan / Singapore`); response includes `count` (total matching)
- **All languages:** `FundamentalContext` gains `macroeconomic(indicator_code, start_date, end_date, offset, limit)` — historical data for a specific indicator via `GET /v1/quote/macrodata/{indicator_code}`; `start_date` / `end_date` accept `"YYYY-MM-DD"` strings; response includes `count` (total data points)
- New types: `MultiLanguageText`, `MacroeconomicCountry`, `MacroeconomicImportance`, `MacroeconomicIndicator`, `MacroeconomicIndicatorListResponse`, `Macroeconomic`, `MacroeconomicResponse`

### Fixed

- `MacroeconomicIndicator.describe` / `name` / `MacroeconomicResponse.info`: handle `null` responses from API without deserializing error

## [4.3.0]

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "3"
members = ["rust", "python", "nodejs", "java", "c"]

[workspace.package]
version = "4.3.0"
version = "4.3.1"
edition = "2024"

[profile.release]
Expand Down
12 changes: 6 additions & 6 deletions c/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ args = ["cargo-build_longbridge_c"]
cwd = "cmake.build"

[tasks.c.windows]
command = "msbuild"
args = ["longbridge.sln", "-p:Configuration=Debug", "/t:cargo-build_longbridge_c"]
command = "cmake"
args = ["--build", ".", "--config", "Debug", "--target", "cargo-build_longbridge_c"]
cwd = "cmake.build"

[tasks.c-release.windows]
command = "msbuild"
args = ["longbridge.sln", "-p:Configuration=Release", "/t:cargo-build_longbridge_c"]
command = "cmake"
args = ["--build", ".", "--config", "Release", "--target", "cargo-build_longbridge_c"]
cwd = "cmake.build"

[tasks.c-test]
Expand All @@ -24,6 +24,6 @@ args = ["test-c"]
cwd = "cmake.build"

[tasks.c-test.windows]
command = "msbuild"
args = ["longbridge.sln", "-p:Configuration=Debug", "/t:test-c"]
command = "cmake"
args = ["--build", ".", "--config", "Debug", "--target", "test-c"]
cwd = "cmake.build"
12 changes: 6 additions & 6 deletions cpp/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ args = ["longbridge_cpp"]
cwd = "cmake.build"

[tasks.cpp.windows]
command = "msbuild"
args = ["longbridge.sln", "-p:Configuration=Debug", "/t:longbridge_cpp"]
command = "cmake"
args = ["--build", ".", "--config", "Debug", "--target", "longbridge_cpp"]
cwd = "cmake.build"

[tasks.cpp-release.windows]
command = "msbuild"
args = ["longbridge.sln", "-p:Configuration=Release", "/t:longbridge_cpp"]
command = "cmake"
args = ["--build", ".", "--config", "Release", "--target", "longbridge_cpp"]
cwd = "cmake.build"

[tasks.cpp-test]
Expand All @@ -24,6 +24,6 @@ args = ["test-cpp"]
cwd = "cmake.build"

[tasks.cpp-test.windows]
command = "msbuild"
args = ["longbridge.sln", "-p:Configuration=Debug", "/t:test-cpp"]
command = "cmake"
args = ["--build", ".", "--config", "Debug", "--target", "test-cpp"]
cwd = "cmake.build"
8 changes: 8 additions & 0 deletions java/javasrc/src/main/java/com/longbridge/SdkNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ public static native void fundamentalContextGetFinancialReportSnapshot(long cont
Object opts,
AsyncCallback callback);

public static native void fundamentalContextMacroeconomicIndicators(long context,
Object country, Object offset, Object limit,
AsyncCallback callback);

public static native void fundamentalContextMacroeconomic(long context,
Object indicatorCode, Object startTime, Object endTime, Object offset, Object limit,
AsyncCallback callback);

public static native void portfolioContextProfitAnalysisFlows(long context, Object opts,
AsyncCallback callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,24 @@ public CompletableFuture<ValuationComparisonResponse> getValuationComparison(Val
SdkNative.fundamentalContextValuationComparison(raw, opts, callback);
});
}

/**
* List macroeconomic indicators.
* country: ISO country code string (e.g. "US", "CN", "EU"); pass null for all countries.
*/
public CompletableFuture<MacroeconomicIndicatorListResponse> getMacroeconomicIndicators(String country, Integer offset, Integer limit) throws OpenApiException {
return AsyncCallback.executeTask((callback) -> {
SdkNative.fundamentalContextMacroeconomicIndicators(raw, country, offset, limit, callback);
});
}

/**
* Get historical data for a macroeconomic indicator.
* startDate and endDate are date strings in "YYYY-MM-DD" format.
*/
public CompletableFuture<MacroeconomicResponse> getMacroeconomic(String indicatorCode, String startDate, String endDate, Integer offset, Integer limit) throws OpenApiException {
return AsyncCallback.executeTask((callback) -> {
SdkNative.fundamentalContextMacroeconomic(raw, indicatorCode, startDate, endDate, offset, limit, callback);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.longbridge.fundamental;

/** One historical data point for a macroeconomic indicator. */
public class Macroeconomic {
/** Statistical period (e.g. 2024-Q1, 2024-03). */
public String period;
public String releaseAt;
public String actualValue;
public String previousValue;
public String forecastValue;
public String revisedValue;
public String nextReleaseAt;
public MultiLanguageText unit;
public MultiLanguageText unitPrefix;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.longbridge.fundamental;

/** Metadata for one macroeconomic indicator. */
public class MacroeconomicIndicator {
/** External vendor code (input to getEconomicIndicator). */
public String indicatorCode;
public String sourceOrg;
public String country;
public MultiLanguageText name;
public String adjustmentFactor;
/** Release periodicity (e.g. monthly / quarterly). */
public String periodicity;
public String category;
public MultiLanguageText describe;
/** Importance — higher is more important. */
public int importance;
/** Start date of data coverage (unix timestamp string). */
public String startDate;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.longbridge.fundamental;

/** Response for {@link FundamentalContext#getMacroeconomicIndicators}. */
public class MacroeconomicIndicatorListResponse {
public MacroeconomicIndicator[] data;
/** Total number of indicators matching the query. */
public int count;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.longbridge.fundamental;

/** Response for {@link FundamentalContext#getMacroeconomic}. */
public class MacroeconomicResponse {
public MacroeconomicIndicator info;
public Macroeconomic[] data;
/** Total number of historical data points. */
public int count;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.longbridge.fundamental;

/** Localized text in simplified Chinese, traditional Chinese, and English. */
public class MultiLanguageText {
public String english;
public String simplifiedChinese;
public String traditionalChinese;
}
66 changes: 66 additions & 0 deletions java/src/fundamental_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,69 @@ pub unsafe extern "system" fn Java_com_longbridge_SdkNative_fundamentalContextVa
Ok(())
})
}

#[unsafe(no_mangle)]
pub unsafe extern "system" fn Java_com_longbridge_SdkNative_fundamentalContextMacroeconomicIndicators(
mut env: JNIEnv,
_class: JClass,
context: i64,
country: JObject,
offset: JObject,
limit: JObject,
callback: JObject,
) {
jni_result(&mut env, (), |env| {
let context = &*(context as *const ContextObj);
let country: Option<String> = FromJValue::from_jvalue(env, country.into())?;
let country = country.and_then(|s| {
use longbridge::fundamental::MacroeconomicCountry::*;
match s.as_str() {
"HK" | "Hong Kong SAR China" => Some(HongKong),
"CN" | "China (Mainland)" => Some(China),
"US" | "United States" => Some(UnitedStates),
"EU" | "Euro Zone" => Some(EuroZone),
"JP" | "Japan" => Some(Japan),
"SG" | "Singapore" => Some(Singapore),
_ => None,
}
});
let offset: Option<i32> = FromJValue::from_jvalue(env, offset.into())?;
let limit: Option<i32> = FromJValue::from_jvalue(env, limit.into())?;
async_util::execute(env, callback, async move {
Ok(context
.ctx
.macroeconomic_indicators(country, offset, limit)
.await?)
})?;
Ok(())
})
}

#[unsafe(no_mangle)]
pub unsafe extern "system" fn Java_com_longbridge_SdkNative_fundamentalContextMacroeconomic(
mut env: JNIEnv,
_class: JClass,
context: i64,
indicator_code: JObject,
start_time: JObject,
end_time: JObject,
offset: JObject,
limit: JObject,
callback: JObject,
) {
jni_result(&mut env, (), |env| {
let context = &*(context as *const ContextObj);
let indicator_code: String = FromJValue::from_jvalue(env, indicator_code.into())?;
let start_date: Option<String> = FromJValue::from_jvalue(env, start_time.into())?;
let end_date: Option<String> = FromJValue::from_jvalue(env, end_time.into())?;
let offset: Option<i32> = FromJValue::from_jvalue(env, offset.into())?;
let limit: Option<i32> = FromJValue::from_jvalue(env, limit.into())?;
async_util::execute(env, callback, async move {
Ok(context
.ctx
.macroeconomic(indicator_code, start_date, end_date, offset, limit)
.await?)
})?;
Ok(())
})
}
60 changes: 60 additions & 0 deletions java/src/types/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2698,6 +2698,66 @@ impl_java_class!(
]
);

impl_java_class!(
"com/longbridge/fundamental/MultiLanguageText",
longbridge::fundamental::MultiLanguageText,
[english, simplified_chinese, traditional_chinese]
);

impl_java_class!(
"com/longbridge/fundamental/MacroeconomicIndicator",
longbridge::fundamental::MacroeconomicIndicator,
[
indicator_code,
source_org,
country,
name,
adjustment_factor,
periodicity,
category,
describe,
importance,
start_date
]
);

impl_java_class!(
"com/longbridge/fundamental/Macroeconomic",
longbridge::fundamental::Macroeconomic,
[
period,
release_at,
actual_value,
previous_value,
forecast_value,
revised_value,
next_release_at,
unit,
unit_prefix
]
);

impl_java_class!(
"com/longbridge/fundamental/MacroeconomicIndicatorListResponse",
longbridge::fundamental::MacroeconomicIndicatorListResponse,
[
#[java(objarray)]
data,
count
]
);

impl_java_class!(
"com/longbridge/fundamental/MacroeconomicResponse",
longbridge::fundamental::MacroeconomicResponse,
[
info,
#[java(objarray)]
data,
count
]
);

// ── MarketContext: top movers / rank ──────────────────────────────

impl_java_class!(
Expand Down
Loading
Loading