基于区块链的毕业设计bybit-api – 字节api

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计bybit-api – 字节api 是一篇很好的国外资料

bybit-api

bybit-api - 字节api bybit-api - 字节api bybit-api - 字节api bybit-api - 字节api bybit-api - 字节api bybit-api - 字节api

Node.js connector for the Bybit APIs and WebSockets, with TypeScript & browser support.

Installation

npm install --save bybit-api

Issues & Discussion

  • Issues? Check the issues tab.
  • Discuss & collaborate with other node devs? Join our Node.js Algo Traders engineering community on telegram.

Documentation

Most methods accept JS objects. These can be populated using parameters specified by Bybit’s API documentation.

  • Bybit API Inverse Documentation.
  • Bybit API Inverse Futures Documentation.
  • Bybit API Linear Documentation

Structure

This project uses typescript. Resources are stored in 3 key structures:

  • src – the whole connector written in typescript
  • lib – the javascript version of the project (compiled from typescript). This should not be edited directly, as it will be overwritten with each release.
  • dist – the packed bundle of the project for use in browser environments.

Usage

Create API credentials at Bybit

  • Livenet
  • Testnet

REST API Clients

There are three REST API modules as there are some differences in each contract type.

  1. InverseClient for inverse perpetual
  2. InverseFuturesClient for inverse futures
  3. LinearClient for linear perpetual

REST Inverse

To use the inverse REST APIs, import the `InverseClient`. Click here to expand and see full sample:
const { InverseClient } = require('bybit-api');  const restClientOptions = {   // override the max size of the request window (in ms)   recv_window?: number;    // how often to sync time drift with bybit servers   sync_interval_ms?: number | string;    // Default: false. Disable above sync mechanism if true.   disable_time_sync?: boolean;    // Default: false. If true, we'll throw errors if any params are undefined   strict_param_validation?: boolean;    // Optionally override API protocol + domain   // e.g 'https://api.bytick.com'   baseUrl?: string;    // Default: true. whether to try and post-process request exceptions.   parse_exceptions?: boolean; };  const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy'; const useLivenet = false;  const client = new InverseClient(   API_KEY,   PRIVATE_KEY,    // optional, uses testnet by default. Set to 'true' to use livenet.   useLivenet,    // restClientOptions,   // requestLibraryOptions );  client.getApiKeyInfo()   .then(result => {     console.log("apiKey result: ", result);   })   .catch(err => {     console.error("apiKey error: ", err);   });  client.getOrderBook({ symbol: 'BTCUSD' })   .then(result => {     console.log("getOrderBook inverse result: ", result);   })   .catch(err => {     console.error("getOrderBook inverse error: ", err);   });

See inverse-client.ts for further information.

REST Inverse Futures

To use the inverse futures REST APIs, import the `InverseFuturesClient`. Click here to expand and see full sample:
const { InverseFuturesClient } = require('bybit-api');  const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy'; const useLivenet = false;  const client = new InverseFuturesClient(   API_KEY,   PRIVATE_KEY,    // optional, uses testnet by default. Set to 'true' to use livenet.   useLivenet,    // restClientOptions,   // requestLibraryOptions );  client.getApiKeyInfo()   .then(result => {     console.log("apiKey result: ", result);   })   .catch(err => {     console.error("apiKey error: ", err);   });  client.getOrderBook({ symbol: 'BTCUSDH21' })   .then(result => {     console.log("getOrderBook inverse futures result: ", result);   })   .catch(err => {     console.error("getOrderBook inverse futures error: ", err);   });

See inverse-futures-client.ts for further information.

REST Linear

To use the Linear (USDT) REST APIs, import the `LinearClient`. Click here to expand and see full sample:
const { LinearClient } = require('bybit-api');  const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy'; const useLivenet = false;  const client = new LinearClient(   API_KEY,   PRIVATE_KEY,    // optional, uses testnet by default. Set to 'true' to use livenet.   useLivenet,    // restClientOptions,   // requestLibraryOptions );  client.getApiKeyInfo()   .then(result => {     console.log(result);   })   .catch(err => {     console.error(err);   });  client.getOrderBook({ symbol: 'BTCUSDT' })   .then(result => {     console.log("getOrderBook linear result: ", result);   })   .catch(err => {     console.error("getOrderBook linear error: ", err);   });

WebSockets

Inverse & linear WebSockets can be used via a shared `WebsocketClient`. Click here to expand and see full sample:
const { WebsocketClient } = require('bybit-api');  const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy';  const wsConfig = {   key: API_KEY,   secret: PRIVATE_KEY,    /*     The following parameters are optional:   */    // defaults to false == testnet. Set to true for livenet.   // livenet: true    // defaults to false == inverse. Set to true for linear (USDT) trading.   // linear: true    // how long to wait (in ms) before deciding the connection should be terminated & reconnected   // pongTimeout: 1000,    // how often to check (in ms) that WS connection is still alive   // pingInterval: 10000,    // how long to wait before attempting to reconnect (in ms) after connection is closed   // reconnectTimeout: 500,    // config options sent to RestClient (used for time sync). See RestClient docs.   // restOptions: { },    // config for axios used for HTTP requests. E.g for proxy support   // requestOptions: { }    // override which URL to use for websocket connections   // wsUrl: 'wss://stream.bytick.com/realtime' };  const ws = new WebsocketClient(wsConfig);  // subscribe to multiple topics at once ws.subscribe(['position', 'execution', 'trade']);  // and/or subscribe to individual topics on demand ws.subscribe('kline.BTCUSD.1m');  // Listen to events coming from websockets. This is the primary data source ws.on('update', data => {   console.log('update', data); });  // Optional: Listen to websocket connection open event (automatic after subscribing to one or more topics) ws.on('open', ({ wsKey, event }) => {   console.log('connection open for websocket with ID: ' + wsKey); });  // Optional: Listen to responses to websocket queries (e.g. the response after subscribing to a topic) ws.on('response', response => {   console.log('response', response); });  // Optional: Listen to connection close event. Unexpected connection closes are automatically reconnected. ws.on('close', () => {   console.log('connection closed'); });  // Optional: Listen to raw error events. // Note: responses to invalid topics are currently only sent in the "response" event. ws.on('error', err => {   console.error('ERR', err); });

See websocket-client.ts for further information.

Note: for linear websockets, pass linear: true in the constructor options when instancing the WebsocketClient. To connect to both linear and inverse websockets, make two instances of the WebsocketClient.


Customise Logging

Pass a custom logger which supports the log methods silly, debug, notice, info, warning and error, or override methods from the default logger as desired.

Click here to expand and see full sample:
const { WebsocketClient, DefaultLogger } = require('bybit-api');  // Disable all logging on the silly level DefaultLogger.silly = () => {};  const ws = new WebsocketClient(   { key: 'xxx', secret: 'yyy' },   DefaultLogger );

Browser Usage

Build a bundle using webpack:

  • npm install
  • npm build
  • npm pack

The bundle can be found in dist/. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO.

However, note that browser usage will lead to CORS errors due Bybit. See issue #79 for more information & alternative suggestions.


Contributions & Thanks

Donations

tiagosiebler

If you found this project interesting or useful, create accounts with my referral links:

  • Bybit
  • Binance

Or buy me a coffee using any of these:

  • BTC: 1C6GWZL1XW3jrjpPTS863XtZiXL1aTK7Jk
  • ETH (ERC20): 0xd773d8e6a50758e1ada699bb6c4f98bb4abf82da

pixtron

The original library was started by @pixtron. If this library helps you to trade better on bybit, feel free to donate a coffee to @pixtron:

  • BTC 1Fh1158pXXudfM6ZrPJJMR7Y5SgZUz4EdF
  • ETH 0x21aEdeC53ab7593b77C9558942f0c9E78131e8d7
  • LTC LNdHSVtG6UWsriMYLJR3qLdfVNKwJ6GSLF

Contributions & Pull Requests

Contributions are encouraged, I will review any incoming pull requests. See the issues tab for todo items.

Merge pull request


文档

<bybit-api><bybit-api><bybit-api><bybit-api><bybit-api><bybit-api><bybit-api><bybit-api><bybit-api><bybit-api><bybit-api>

用于字节API和WebSocket的Node.js连接器,带有TypeScript&amp;浏览器支持

npm安装——保存字节api

大多数方法都接受JS对象。可以使用Bybit的API文档指定的参数填充这些参数

此项目使用typescript。资源存储在3个关键结构中:

在Bybit创建API凭据

有三个REST API模块,因为每种合同类型都有一些差异

有关更多信息,请参阅reverse-client.ts

有关更多信息,请参阅inverse-futures-client.ts

有关更多信息,请参阅websocket-client.ts

注意:对于线性websockets,在实例化WebsocketClient时,在构造函数选项中传递linear:true。要连接到线性和反向WebSocket,请创建WebsocketClient的两个实例

传递一个自定义记录器,该记录器支持日志方法、调试、通知、信息、警告和错误,或者根据需要覆盖默认记录器中的方法

使用webpack构建捆绑包:

该捆绑包可以在dist/中找到。虽然用法应该大体一致,但会存在较小的差异。文档编制仍有待完成

但是,请注意,使用浏览器会导致因字节而导致CORS错误。有关更多信息,请参见第79期;其他建议

如果您觉得此项目有趣或有用,请使用我的推荐链接创建帐户:

或使用以下任何链接为我买杯咖啡:

原始库是由@pixtron创建的。如果此库帮助您更好地使用bybit进行交易,请随时向@pixtron捐赠一杯咖啡:

鼓励您捐款,我将审查任何传入的pull请求。有关待办事项,请参见“问题”选项卡

字节api的安装问题;讨论

文档

结构

使用

REST API客户端

REST反向

REST反向期货

REST线性

WebSocket

自定义日志记录

浏览器使用

贡献&amp;感谢

捐款

蒂亚戈西布勒

派克斯特龙

捐款和;拉取请求问题?检查“问题”选项卡
  • 讨论&amp;与其他节点开发人员协作?通过telegram加入我们的Node.js Algo Traders工程社区
  • 字节API反向文档

    字节API反向期货文档

  • 字节API线性文档
  • src-用typescript编写的整个连接器
  • lib-项目的javascript版本(从typescript编译)。这不应直接编辑,因为每次发布都会覆盖它
  • dist—用于浏览器环境的项目打包包
  • Livenet
  • Testnet
  • 反向期货反向期货反向期货客户
  • 线性期货反向期货
  • npm安装
  • npm构建

  • npm包
  • 字节

  • 二进制
  • BTC:1C6GWZL1xW3JRJPPTS863XT1ATK7JK

  • ETH(ERC20):0xd773d8e6a50758e1ada699bb6c4f98bb4abf82da
  • BTC 1Fh1158pXXudfM6ZrPJJMR7Y5SgZUz4EdF
  • ETH 0x21aEdeC53ab7593b77C9558942f0c9E78131e8d7
  • LTC LNDHSVTG6UWSRIMYR3QLDFKWJ6GSLF
  • Node.js connector for the Bybit APIs and WebSockets, with TypeScript & browser support.

    结构

    用于字节API和WebSocket的Node.js连接器,带有TypeScript&amp;浏览器支持

    使用

    • 讨论&amp;与其他节点开发人员协作?通过telegram加入我们的Node.js Algo Traders工程社区
    • 字节API线性文档

    REST API客户端

    npm安装——保存字节api

    • src-用typescript编写的整个连接器
    • lib-项目的javascript版本(从typescript编译)。这不应直接编辑,因为每次发布都会覆盖它
    • dist—用于浏览器环境的项目打包包

    REST反向

    大多数方法都接受JS对象。可以使用Bybit的API文档指定的参数填充这些参数

    • Livenet
    • Testnet
    • dist – the packed bundle of the project for use in browser environments.

    自定义日志记录

    此项目使用typescript。资源存储在3个关键结构中:

    • 反向期货反向期货反向期货客户
    • 线性期货反向期货

    浏览器使用

    在Bybit创建API凭据

    1. npm安装
    2. npm包
    3. 二进制

    贡献&amp;感谢

    To use the inverse REST APIs, import the `InverseClient`. Click here to expand and see full sample:
    const { InverseClient } = require('bybit-api');  const restClientOptions = {   // override the max size of the request window (in ms)   recv_window?: number;    // how often to sync time drift with bybit servers   sync_interval_ms?: number | string;    // Default: false. Disable above sync mechanism if true.   disable_time_sync?: boolean;    // Default: false. If true, we'll throw errors if any params are undefined   strict_param_validation?: boolean;    // Optionally override API protocol + domain   // e.g 'https://api.bytick.com'   baseUrl?: string;    // Default: true. whether to try and post-process request exceptions.   parse_exceptions?: boolean; };  const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy'; const useLivenet = false;  const client = new InverseClient(   API_KEY,   PRIVATE_KEY,    // optional, uses testnet by default. Set to 'true' to use livenet.   useLivenet,    // restClientOptions,   // requestLibraryOptions );  client.getApiKeyInfo()   .then(result => {     console.log("apiKey result: ", result);   })   .catch(err => {     console.error("apiKey error: ", err);   });  client.getOrderBook({ symbol: 'BTCUSD' })   .then(result => {     console.log("getOrderBook inverse result: ", result);   })   .catch(err => {     console.error("getOrderBook inverse error: ", err);   });

    有三个REST API模块,因为每种合同类型都有一些差异

    捐款

    To use the inverse futures REST APIs, import the `InverseFuturesClient`. Click here to expand and see full sample:
    const { InverseFuturesClient } = require('bybit-api');  const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy'; const useLivenet = false;  const client = new InverseFuturesClient(   API_KEY,   PRIVATE_KEY,    // optional, uses testnet by default. Set to 'true' to use livenet.   useLivenet,    // restClientOptions,   // requestLibraryOptions );  client.getApiKeyInfo()   .then(result => {     console.log("apiKey result: ", result);   })   .catch(err => {     console.error("apiKey error: ", err);   });  client.getOrderBook({ symbol: 'BTCUSDH21' })   .then(result => {     console.log("getOrderBook inverse futures result: ", result);   })   .catch(err => {     console.error("getOrderBook inverse futures error: ", err);   });

    有关更多信息,请参阅reverse-client.ts

    蒂亚戈西布勒

    To use the Linear (USDT) REST APIs, import the `LinearClient`. Click here to expand and see full sample:
    const { LinearClient } = require('bybit-api');  const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy'; const useLivenet = false;  const client = new LinearClient(   API_KEY,   PRIVATE_KEY,    // optional, uses testnet by default. Set to 'true' to use livenet.   useLivenet,    // restClientOptions,   // requestLibraryOptions );  client.getApiKeyInfo()   .then(result => {     console.log(result);   })   .catch(err => {     console.error(err);   });  client.getOrderBook({ symbol: 'BTCUSDT' })   .then(result => {     console.log("getOrderBook linear result: ", result);   })   .catch(err => {     console.error("getOrderBook linear error: ", err);   });

    派克斯特龙

    Inverse & linear WebSockets can be used via a shared `WebsocketClient`. Click here to expand and see full sample:
    const { WebsocketClient } = require('bybit-api');  const API_KEY = 'xxx'; const PRIVATE_KEY = 'yyy';  const wsConfig = {   key: API_KEY,   secret: PRIVATE_KEY,    /*     The following parameters are optional:   */    // defaults to false == testnet. Set to true for livenet.   // livenet: true    // defaults to false == inverse. Set to true for linear (USDT) trading.   // linear: true    // how long to wait (in ms) before deciding the connection should be terminated & reconnected   // pongTimeout: 1000,    // how often to check (in ms) that WS connection is still alive   // pingInterval: 10000,    // how long to wait before attempting to reconnect (in ms) after connection is closed   // reconnectTimeout: 500,    // config options sent to RestClient (used for time sync). See RestClient docs.   // restOptions: { },    // config for axios used for HTTP requests. E.g for proxy support   // requestOptions: { }    // override which URL to use for websocket connections   // wsUrl: 'wss://stream.bytick.com/realtime' };  const ws = new WebsocketClient(wsConfig);  // subscribe to multiple topics at once ws.subscribe(['position', 'execution', 'trade']);  // and/or subscribe to individual topics on demand ws.subscribe('kline.BTCUSD.1m');  // Listen to events coming from websockets. This is the primary data source ws.on('update', data => {   console.log('update', data); });  // Optional: Listen to websocket connection open event (automatic after subscribing to one or more topics) ws.on('open', ({ wsKey, event }) => {   console.log('connection open for websocket with ID: ' + wsKey); });  // Optional: Listen to responses to websocket queries (e.g. the response after subscribing to a topic) ws.on('response', response => {   console.log('response', response); });  // Optional: Listen to connection close event. Unexpected connection closes are automatically reconnected. ws.on('close', () => {   console.log('connection closed'); });  // Optional: Listen to raw error events. // Note: responses to invalid topics are currently only sent in the "response" event. ws.on('error', err => {   console.error('ERR', err); });

    有关更多信息,请参阅inverse-futures-client.ts

    有关更多信息,请参阅websocket-client.ts


    捐款和;拉取请求问题?检查“问题”选项卡
  • 讨论&amp;与其他节点开发人员协作?通过telegram加入我们的Node.js Algo Traders工程社区
  • 字节API反向文档

    字节API反向期货文档

  • 字节API线性文档
  • src-用typescript编写的整个连接器
  • lib-项目的javascript版本(从typescript编译)。这不应直接编辑,因为每次发布都会覆盖它
  • dist—用于浏览器环境的项目打包包
  • Livenet
  • Testnet
  • 反向期货反向期货反向期货客户
  • 线性期货反向期货
  • npm安装
  • npm构建

  • npm包
  • 字节

  • 二进制
  • BTC:1C6GWZL1xW3JRJPPTS863XT1ATK7JK

  • ETH(ERC20):0xd773d8e6a50758e1ada699bb6c4f98bb4abf82da
  • BTC 1Fh1158pXXudfM6ZrPJJMR7Y5SgZUz4EdF
  • ETH 0x21aEdeC53ab7593b77C9558942f0c9E78131e8d7
  • LTC LNDHSVTG6UWSRIMYR3QLDFKWJ6GSLF
  • 注意:对于线性websockets,在实例化WebsocketClient时,在构造函数选项中传递linear:true。要连接到线性和反向WebSocket,请创建WebsocketClient的两个实例

    Click here to expand and see full sample:
    const { WebsocketClient, DefaultLogger } = require('bybit-api');  // Disable all logging on the silly level DefaultLogger.silly = () => {};  const ws = new WebsocketClient(   { key: 'xxx', secret: 'yyy' },   DefaultLogger );

    Browser Usage

    传递一个自定义记录器,该记录器支持日志方法、调试、通知、信息、警告和错误,或者根据需要覆盖默认记录器中的方法

    • ETH(ERC20):0xd773d8e6a50758e1ada699bb6c4f98bb4abf82da
    • BTC 1Fh1158pXXudfM6ZrPJJMR7Y5SgZUz4EdF
    • ETH 0x21aEdeC53ab7593b77C9558942f0c9E78131e8d7

    使用webpack构建捆绑包:

    该捆绑包可以在dist/中找到。虽然用法应该大体一致,但会存在较小的差异。文档编制仍有待完成


    Contributions & Thanks

    Donations

    tiagosiebler

    但是,请注意,使用浏览器会导致因字节而导致CORS错误。有关更多信息,请参见第79期;其他建议

    • LTC LNDHSVTG6UWSRIMYR3QLDFKWJ6GSLF
    • Binance

    如果您觉得此项目有趣或有用,请使用我的推荐链接创建帐户:

    • BTC: 1C6GWZL1XW3jrjpPTS863XtZiXL1aTK7Jk
    • ETH (ERC20): 0xd773d8e6a50758e1ada699bb6c4f98bb4abf82da

    pixtron

    或使用以下任何链接为我买杯咖啡:

    • BTC 1Fh1158pXXudfM6ZrPJJMR7Y5SgZUz4EdF
    • ETH 0x21aEdeC53ab7593b77C9558942f0c9E78131e8d7
    • LTC LNdHSVtG6UWsriMYLJR3qLdfVNKwJ6GSLF

    Contributions & Pull Requests

    原始库是由@pixtron创建的。如果此库帮助您更好地使用bybit进行交易,请随时向@pixtron捐赠一杯咖啡:

    Merge pull request

    部分转自网络,侵权联系删除区块链源码网

    www.interchains.cc

    https://www.interchains.cc/23778.html

    区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
    区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计bybit-api – 字节api

    提供最优质的资源集合

    立即查看 了解详情