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
33 changes: 18 additions & 15 deletions docs/en/docs/market/calendar/dividend_calendar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ longbridge finance-calendar dividend --filter positions
| start | string | YES | Start date, YYYY-MM-DD |
| end | string | YES | End date, YYYY-MM-DD |
| market | string | NO | Market filter: `US`, `HK`, `SH`, `SZ`. Omit for all. |
| count | integer | NO | Max events per page; server default when omitted |
| offset | integer | NO | Number of events to skip from the start of the window |
| next | CalendarPageDirection | NO | Page direction from the `next_date` cursor: `Later` or `Earlier` |

## Request Example

<Tabs groupId="request-example">
<TabItem value="python" label="Python">

```python
from longbridge.openapi import CalendarContext, Config, OAuthBuilder
from longbridge.openapi import CalendarContext, CalendarCategory, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = CalendarContext(config)

resp = ctx.dividend_calendar("AAPL.US")
resp = ctx.finance_calendar(CalendarCategory.Dividend, "2024-01-01", "2024-03-31")
print(resp)
```

Expand All @@ -51,14 +54,14 @@ print(resp)

```python
import asyncio
from longbridge.openapi import AsyncCalendarContext, Config, OAuthBuilder
from longbridge.openapi import AsyncCalendarContext, CalendarCategory, Config, OAuthBuilder

async def main() -> None:
oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = AsyncCalendarContext.create(config)

resp = await ctx.dividend_calendar("AAPL.US")
resp = await ctx.finance_calendar(CalendarCategory.Dividend, "2024-01-01", "2024-03-31")
print(resp)

if __name__ == "__main__":
Expand All @@ -69,15 +72,15 @@ if __name__ == "__main__":
<TabItem value="nodejs" label="Node.js">

```javascript
const { Config, CalendarContext, OAuth } = require('longbridge')
const { Config, CalendarContext, CalendarCategory, OAuth } = require('longbridge')

async function main() {
const oauth = await OAuth.build('your-client-id', (_, url) => {
console.log('Open this URL to authorize: ' + url)
})
const config = Config.fromOAuth(oauth)
const ctx = CalendarContext.new(config)
const resp = await ctx.dividend_calendar('AAPL.US')
const resp = await ctx.financeCalendar(CalendarCategory.Dividend, '2024-01-01', '2024-03-31')
console.log(resp)
}
main().catch(console.error)
Expand All @@ -95,7 +98,7 @@ class Main {
try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get();
Config config = Config.fromOAuth(oauth);
CalendarContext ctx = CalendarContext.create(config)) {
var resp = ctx.getDividendCalendar("AAPL.US").get();
var resp = ctx.financeCalendar(CalendarCategory.Dividend, "2024-01-01", "2024-03-31", null).get();
System.out.println(resp);
}
}
Expand All @@ -107,14 +110,14 @@ class Main {

```rust
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, calendar::CalendarContext, Config};
use longbridge::{oauth::OAuthBuilder, calendar::{CalendarContext, CalendarCategory}, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open: {url}")).await?;
let config = Arc::new(Config::from_oauth(oauth));
let ctx = CalendarContext::new(config);
let resp = ctx.dividend_calendar("AAPL.US").await?;
let resp = ctx.finance_calendar(CalendarCategory::Dividend, "2024-01-01", "2024-03-31", None, None, None, None).await?;
println!("{:?}", resp);
Ok(())
}
Expand All @@ -137,7 +140,7 @@ int main() {
if (!res) return;
Config config = Config::from_oauth(*res);
CalendarContext ctx = CalendarContext::create(config);
ctx.dividend_calendar("AAPL.US", [](auto resp) {
ctx.finance_calendar(CalendarCategory::Dividend, "2024-01-01", "2024-03-31", "", std::nullopt, std::nullopt, std::nullopt, [](auto resp) {
if (resp) std::cout << "OK" << std::endl;
});
});
Expand Down Expand Up @@ -176,7 +179,7 @@ func main() {
log.Fatal(err)
}
defer c.Close()
resp, err := c.DividendCalendar(context.Background(), "AAPL.US")
resp, err := c.FinanceCalendar(context.Background(), "Dividend", "2024-01-01", "2024-03-31", nil)
if err != nil {
log.Fatal(err)
}
Expand All @@ -197,11 +200,11 @@ func main() {
"code": 0,
"message": "success",
"data": {
"date": "2026-04-30",
"date": "2024-01-01",
"list": [
{
"date": "2026-04-30",
"count": 275,
"date": "2024-01-15",
"count": 1,
"infos": [
{
"id": "12345",
Expand All @@ -210,7 +213,7 @@ func main() {
"counter_name": "Apple Inc.",
"event_type": "",
"activity_type": "",
"date": "2026-05-14",
"date": "2024-01-15",
"datetime": "",
"content": "",
"star": 0,
Expand Down
33 changes: 18 additions & 15 deletions docs/en/docs/market/calendar/earnings_calendar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ longbridge finance-calendar report --market US
| start | string | YES | Start date, YYYY-MM-DD |
| end | string | YES | End date, YYYY-MM-DD |
| market | string | NO | Market filter: `US`, `HK`, `SH`, `SZ`. Omit for all. |
| count | integer | NO | Max events per page; server default when omitted |
| offset | integer | NO | Number of events to skip from the start of the window |
| next | CalendarPageDirection | NO | Page direction from the `next_date` cursor: `Later` or `Earlier` |

## Request Example

<Tabs groupId="request-example">
<TabItem value="python" label="Python">

```python
from longbridge.openapi import CalendarContext, Config, OAuthBuilder
from longbridge.openapi import CalendarContext, CalendarCategory, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = CalendarContext(config)

resp = ctx.earnings_calendar("AAPL.US")
resp = ctx.finance_calendar(CalendarCategory.Report, "2024-01-01", "2024-03-31")
print(resp)
```

Expand All @@ -51,14 +54,14 @@ print(resp)

```python
import asyncio
from longbridge.openapi import AsyncCalendarContext, Config, OAuthBuilder
from longbridge.openapi import AsyncCalendarContext, CalendarCategory, Config, OAuthBuilder

async def main() -> None:
oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = AsyncCalendarContext.create(config)

resp = await ctx.earnings_calendar("AAPL.US")
resp = await ctx.finance_calendar(CalendarCategory.Report, "2024-01-01", "2024-03-31")
print(resp)

if __name__ == "__main__":
Expand All @@ -69,15 +72,15 @@ if __name__ == "__main__":
<TabItem value="nodejs" label="Node.js">

```javascript
const { Config, CalendarContext, OAuth } = require('longbridge')
const { Config, CalendarContext, CalendarCategory, OAuth } = require('longbridge')

async function main() {
const oauth = await OAuth.build('your-client-id', (_, url) => {
console.log('Open this URL to authorize: ' + url)
})
const config = Config.fromOAuth(oauth)
const ctx = CalendarContext.new(config)
const resp = await ctx.earnings_calendar('AAPL.US')
const resp = await ctx.financeCalendar(CalendarCategory.Report, '2024-01-01', '2024-03-31')
console.log(resp)
}
main().catch(console.error)
Expand All @@ -95,7 +98,7 @@ class Main {
try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get();
Config config = Config.fromOAuth(oauth);
CalendarContext ctx = CalendarContext.create(config)) {
var resp = ctx.getEarningsCalendar("AAPL.US").get();
var resp = ctx.financeCalendar(CalendarCategory.Report, "2024-01-01", "2024-03-31", null).get();
System.out.println(resp);
}
}
Expand All @@ -107,14 +110,14 @@ class Main {

```rust
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, calendar::CalendarContext, Config};
use longbridge::{oauth::OAuthBuilder, calendar::{CalendarContext, CalendarCategory}, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open: {url}")).await?;
let config = Arc::new(Config::from_oauth(oauth));
let ctx = CalendarContext::new(config);
let resp = ctx.earnings_calendar("AAPL.US").await?;
let resp = ctx.finance_calendar(CalendarCategory::Report, "2024-01-01", "2024-03-31", None, None, None, None).await?;
println!("{:?}", resp);
Ok(())
}
Expand All @@ -137,7 +140,7 @@ int main() {
if (!res) return;
Config config = Config::from_oauth(*res);
CalendarContext ctx = CalendarContext::create(config);
ctx.earnings_calendar("AAPL.US", [](auto resp) {
ctx.finance_calendar(CalendarCategory::Report, "2024-01-01", "2024-03-31", "", std::nullopt, std::nullopt, std::nullopt, [](auto resp) {
if (resp) std::cout << "OK" << std::endl;
});
});
Expand Down Expand Up @@ -176,7 +179,7 @@ func main() {
log.Fatal(err)
}
defer c.Close()
resp, err := c.EarningsCalendar(context.Background(), "AAPL.US")
resp, err := c.FinanceCalendar(context.Background(), "Report", "2024-01-01", "2024-03-31", nil)
if err != nil {
log.Fatal(err)
}
Expand All @@ -197,11 +200,11 @@ func main() {
"code": 0,
"message": "success",
"data": {
"date": "2026-04-30",
"date": "2024-01-01",
"list": [
{
"date": "2026-04-30",
"count": 2228,
"date": "2024-01-15",
"count": 1,
"infos": [
{
"id": "12345",
Expand All @@ -210,7 +213,7 @@ func main() {
"counter_name": "Apple Inc.",
"event_type": "",
"activity_type": "",
"date": "2026-05-14",
"date": "2024-01-15",
"datetime": "",
"content": "",
"star": 0,
Expand Down
31 changes: 17 additions & 14 deletions docs/en/docs/market/calendar/ipo_calendar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ longbridge finance-calendar ipo --market US
| start | string | YES | Start date, YYYY-MM-DD |
| end | string | YES | End date, YYYY-MM-DD |
| market | string | NO | Market filter: `US`, `HK`, `SH`, `SZ`. Omit for all. |
| count | integer | NO | Max events per page; server default when omitted |
| offset | integer | NO | Number of events to skip from the start of the window |
| next | CalendarPageDirection | NO | Page direction from the `next_date` cursor: `Later` or `Earlier` |

## Request Example

<Tabs groupId="request-example">
<TabItem value="python" label="Python">

```python
from longbridge.openapi import CalendarContext, Config, OAuthBuilder
from longbridge.openapi import CalendarContext, CalendarCategory, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = CalendarContext(config)

resp = ctx.ipo_calendar("AAPL.US")
resp = ctx.finance_calendar(CalendarCategory.Ipo, "2024-01-01", "2024-03-31")
print(resp)
```

Expand All @@ -51,14 +54,14 @@ print(resp)

```python
import asyncio
from longbridge.openapi import AsyncCalendarContext, Config, OAuthBuilder
from longbridge.openapi import AsyncCalendarContext, CalendarCategory, Config, OAuthBuilder

async def main() -> None:
oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = AsyncCalendarContext.create(config)

resp = await ctx.ipo_calendar("AAPL.US")
resp = await ctx.finance_calendar(CalendarCategory.Ipo, "2024-01-01", "2024-03-31")
print(resp)

if __name__ == "__main__":
Expand All @@ -69,15 +72,15 @@ if __name__ == "__main__":
<TabItem value="nodejs" label="Node.js">

```javascript
const { Config, CalendarContext, OAuth } = require('longbridge')
const { Config, CalendarContext, CalendarCategory, OAuth } = require('longbridge')

async function main() {
const oauth = await OAuth.build('your-client-id', (_, url) => {
console.log('Open this URL to authorize: ' + url)
})
const config = Config.fromOAuth(oauth)
const ctx = CalendarContext.new(config)
const resp = await ctx.ipo_calendar('AAPL.US')
const resp = await ctx.financeCalendar(CalendarCategory.Ipo, '2024-01-01', '2024-03-31')
console.log(resp)
}
main().catch(console.error)
Expand All @@ -95,7 +98,7 @@ class Main {
try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get();
Config config = Config.fromOAuth(oauth);
CalendarContext ctx = CalendarContext.create(config)) {
var resp = ctx.getIpoCalendar("AAPL.US").get();
var resp = ctx.financeCalendar(CalendarCategory.Ipo, "2024-01-01", "2024-03-31", null).get();
System.out.println(resp);
}
}
Expand All @@ -107,14 +110,14 @@ class Main {

```rust
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, calendar::CalendarContext, Config};
use longbridge::{oauth::OAuthBuilder, calendar::{CalendarContext, CalendarCategory}, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open: {url}")).await?;
let config = Arc::new(Config::from_oauth(oauth));
let ctx = CalendarContext::new(config);
let resp = ctx.ipo_calendar("AAPL.US").await?;
let resp = ctx.finance_calendar(CalendarCategory::Ipo, "2024-01-01", "2024-03-31", None, None, None, None).await?;
println!("{:?}", resp);
Ok(())
}
Expand All @@ -137,7 +140,7 @@ int main() {
if (!res) return;
Config config = Config::from_oauth(*res);
CalendarContext ctx = CalendarContext::create(config);
ctx.ipo_calendar("AAPL.US", [](auto resp) {
ctx.finance_calendar(CalendarCategory::Ipo, "2024-01-01", "2024-03-31", "", std::nullopt, std::nullopt, std::nullopt, [](auto resp) {
if (resp) std::cout << "OK" << std::endl;
});
});
Expand Down Expand Up @@ -176,7 +179,7 @@ func main() {
log.Fatal(err)
}
defer c.Close()
resp, err := c.IpoCalendar(context.Background(), "AAPL.US")
resp, err := c.FinanceCalendar(context.Background(), "Ipo", "2024-01-01", "2024-03-31", nil)
if err != nil {
log.Fatal(err)
}
Expand All @@ -197,10 +200,10 @@ func main() {
"code": 0,
"message": "success",
"data": {
"date": "2026-04-30",
"date": "2024-01-01",
"list": [
{
"date": "2026-05-05",
"date": "2024-01-15",
"count": 1,
"infos": [
{
Expand All @@ -210,7 +213,7 @@ func main() {
"counter_name": "Apple Inc.",
"event_type": "",
"activity_type": "",
"date": "2026-05-14",
"date": "2024-01-15",
"datetime": "",
"content": "",
"star": 0,
Expand Down
Loading
Loading