Longbridge Developers
立即開始

美股加密貨幣概覽

Longbridge US 賬戶

此方法僅適用於美國數據中心賬戶。

獲取美股加密貨幣交易對的概覽資訊——歷史最高/最低價、資產詳情和貨幣資訊。

>_ CLI
# 美股加密貨幣概覽
longbridge static DOGEUSD.BKKT

Parameters

SDK 方法參數。

名稱類型必填描述
symbolstring是加密貨幣交易對,例如 DOGEUSD.BKKT

Request Example

from longbridge.openapi import QuoteContext, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("請訪問:", url))
config = Config.from_oauth(oauth)
ctx = QuoteContext(config)
resp = ctx.us_crypto_overview("DOGEUSD.BKKT")
print(resp)
import asyncio
from longbridge.openapi import AsyncQuoteContext, Config, OAuthBuilder

async def main() -> None:
    oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("請訪問:", url))
    config = Config.from_oauth(oauth)
    ctx = AsyncQuoteContext.create(config)
    resp = await ctx.us_crypto_overview("DOGEUSD.BKKT")
    print(resp)

if __name__ == "__main__":
    asyncio.run(main())
const { Config, QuoteContext, OAuth } = require('longbridge')

async function main() {
  const oauth = await OAuth.build('your-client-id', (_, url) => {
    console.log('請訪問此 URL 授權:' + url)
  })
  const config = Config.fromOAuth(oauth)
  const ctx = QuoteContext.new(config)
  const resp = await ctx.usCryptoOverview("DOGEUSD.BKKT")
  console.log(resp)
}
main().catch(console.error)
import com.longbridge.*;
import com.longbridge.quote.*;

class Main {
    public static void main(String[] args) throws Exception {
        try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get();
             Config config = Config.fromOAuth(oauth);
             QuoteContext ctx = QuoteContext.create(config)) {
            var resp = ctx.getUsCryptoOverview("DOGEUSD.BKKT").get();
            System.out.println(resp);
        }
    }
}
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, quote::QuoteContext, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("請訪問:{url}")).await?;
    let config = Arc::new(Config::from_oauth(oauth));
    let ctx = QuoteContext::new(config);
    let resp = ctx.us_crypto_overview("DOGEUSD.BKKT").await?;
    println!("{:?}", resp);
    Ok(())
}
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/longbridge/openapi-go/config"
	"github.com/longbridge/openapi-go/oauth"
	"github.com/longbridge/openapi-go/quote"
)

func main() {
	o := oauth.New("your-client-id").
		OnOpenURL(func(url string) { fmt.Println("Open this URL to authorize:", url) })
	if err := o.Build(context.Background()); err != nil {
		log.Fatal(err)
	}
	conf, err := config.New(config.WithOAuthClient(o))
	if err != nil {
		log.Fatal(err)
	}
	c, err := quote.NewFromCfg(conf)
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()
	resp, err := c.CryptoOverview(context.Background(), "DOGEUSD.BKKT")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", resp)
}

響應字段

字段類型描述
symbolstring交易對代碼
namestring資產名稱
tickerstring簡短代碼
base_assetstring基礎資產代碼
currencystring計價貨幣
all_time_highstring歷史最高價
all_time_high_datestring歷史最高價日期
all_time_lowstring歷史最低價
all_time_low_datestring歷史最低價日期

Response

Response Example

{
  "symbol": "DOGEUSD.BKKT",
  "name": "Dogecoin",
  "ticker": "DOGE",
  "base_asset": "DOGE",
  "currency": "USD",
  "all_time_high": "0.7376",
  "all_time_high_date": "2021-05-08",
  "all_time_low": "0.0000869",
  "all_time_low_date": "2015-05-06",
  "ipo_date": "2013-12-06",
  "shares": "147000000000",
  "official_web_address": "https://dogecoin.com"
}

Response Status

狀態碼描述结构
200成功CryptoOverview
400請求錯誤None

Schemas

CryptoOverview

名稱類型必填描述
symbolstring是交易對代碼,如 DOGEUSD.BKKT
namestring是資產名稱
tickerstring是簡短代碼
base_assetstring是基礎資產代碼,如 DOGE
currencystring是計價貨幣,如 USD
all_time_highstring是歷史最高價
all_time_high_datestring是歷史最高價日期
all_time_lowstring是歷史最低價
all_time_low_datestring是歷史最低價日期
ipo_datestring否初始上市日期
issue_pricestring否初始發行價格
sharesstring否流通總量
official_web_addressstring否官方網站 URL
logostring否資產 Logo URL
wiki_urlstring否Wikipedia URL
profilestring否資產簡介(JSON 字符串)