npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@xtp-smart/sdk

v1.2.0

Published

XTP.Smart.sdk

Downloads

2

Readme

xtp-smart 组件sdk api, 提供TypeScript语言定义。

使用TS语言,能够得到更好的开发体验。

具体API使用方法可以参考组件API文档

安装

npm install --save @xtp-smart/sdk

说明

该npm包没有默认导出,需要指定具体引入对象名。

// 错误示例
import smart from "@xtp-smart/sdk";

// 正确示例
import { smart } from "@xtp-smart/sdk";

该npm包会导出两种类型的对象,一类是变量,一类是类型声明

变量是实际的js对象,可以参与具体的TS运算, 类型声明仅是TS语言概念,是为了约束TS的写法。

具体可使用的导出如下

变量

  • smart - 组件的核心对象,所有组件api都来自于此对象
  • Event - 各种事件名称集合,smart.Event对象的简单写法
  • Type - 各种枚举类型与内部数据结构,smart.Type对象的简单写法
  • Utils - 各种工具类集合,smart.utils对象的简单写法
  • Cache - 持久化缓存对象,smart.cache对象的简单写法
  • Logger - 日志记录对象,smart.logger对象的简单写法

类型声明

各类枚举值

  • Source
  • AccountType
  • Exchange
  • InstrumentType
  • PriceType
  • Side
  • Offset
  • Direction
  • VolumeCondition
  • TimeCondition
  • OrderStatus
  • StrategyPlatformType
  • StrategyStatus

SDK中的各类数据结构

  • Account
  • Order
  • Trade
  • Position
  • Assets
  • Instrument
  • IPO
  • Quote
  • Strategy
  • Book
  • Round

示例

// 导入类型声明
import { Account, Strategy, Position, Order, Quote, Book, PriceType, OrderStatus, StrategyStatus, StrategyPlatformType } from "@xtp-smart/sdk";

// 导入变量声明
import { smart, Type, Utils, Event } from "@xtp-smart/sdk";

namespace demo {

    console.log("Event", Event);

    class Plugin {
        account: Account;
        strategies: {
            [propName: string]: Strategy
        };

        constructor() {
            this.account = smart.current_account;
            this.strategies = this.account.strategy_map; //策略列表

            this.start();
        }

        async start() {
            
        }
    }

    smart.on(Event.ON_INIT, () => {
        console.log("ON_INIT");
        new Plugin();
    });
}

问题反馈

如果使用组件时遇到了任何BUG,可以在smart客户端的主项目中反馈问题。

QQ 交流群: 659577632