Giter Club home page Giter Club logo

tvcd's Introduction

songs-for-the-turtles

tvcd's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tvcd's Issues

Invalid request to Bitfinex will timeout if request is invalid?

When trying to request the last candle to bitfinex i ended up doing the following request:

https://api-pub.bitfinex.com/v2/candles/trade:1D:tBTCUSD/hist?limit=5000&start=1671062400000&end=1671062400000

I can see bitfinex answers very quick in the browser with:

[
  "error",
  10020,
  "time_interval: invalid"
]

But on my jest test it was timing out because it was taking more than 5000 ms to resolve the request.

I wonder if tvcd will keep retrying to request and for that reason the timeout happens?

Use union type instead of enum

This article explain some interesting concepts on unin type VS enum

From some tests i did, string union type provide a better autocomplete experience on VSCode when filling function parameters ( as an end user ).

So when calling functions users can directly type the string value ( and see all options listed on VSCode ) instead of having to import the Enum and use the Enum.

Of course that's a minor detail in implementation, so low priority..

In case that would be implemented we would have an enum like that

export enum Exchanges {
  'binance' = 'binance',
  'binancefuturescoin' = 'binancefuturescoin',
  'binancefuturesusd' = 'binancefuturesusd',
  'bitfinex' = 'bitfinex',
  'bitmex' = 'bitmex',
  'bittrex' = 'bittrex',
  'deversifi' = 'deversifi',
  'gateio' = 'gateio',
  'kucoin' = 'kucoin',
  'poloniex' = 'poloniex',
  'valr' = 'valr',
}

But function arguments that require exchange names as parameters would have type Exchanges instead of ExchangesEnum

export type Exchanges = 
  'binance' | 
  'binancefuturescoin' | 
  'binancefuturesusd' |
  ...

Invalid timeframe request on Bitfinex triggers loads of requests

Today i accidentally tried to ask for 3H candle instead of 3h candle for Bitfinex.

For some reason it triggered tons of requests for Bitfinex and screwed my rate limit.

image

Those are some expectations / suggestions

  • If i send 3H or 3h the library should be able to "translate" it to the right format, TLDR: allow users to use lowercase or uppercase for the letters perhaps looking at this issue could help standardize it
  • The library to normalise the timeframes, for instance 3h has lowercase h but 1D has uppercase D
  • If the library can't determine the timeframe, don't do a request with undefined on the URL ( see screenshot )

Option to fetch 4H candles from Bitfinex

Currently Bitfinex won't allow us to fetch 4H candles directly form their API.

It would be great to add this option and have tvcd consolidate the last 4x1H candles into 1x4H candles by calculating the highest high, lowest low, open, close, and summed volume of those candles.

Break `types/exchanges.ts` into smaller files

I can see you have all types under this file called exchanges but some types could be moved into smaller files.

For instance types related to candles could be moved to types/candles.ts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.