Git Product home page Git Product logo

stonksjs's Introduction

stonksjs

Reliable algotrading utilities written in node

GitHub release (latest SemVer) CI Tests Coveralls github Code Climate maintainability Code Climate technical debt PRs Welcome

Features

  • Custom screeners from finviz, msn, and finscreener
  • Detailed ticker fundamentals
  • Module and CommonJS compatible
  • Light-weight - few to no dependencies

Goals

What stonksjs is:

The primary objective of this project are:

  • To provide a collection of reliable algotrading utilities written in typescript/node
  • Take some of the guess-work out of the stock research process by using industry-tested, predefined screeners
  • Provide more data-points for a given instrument than most packages currently available
  • Enable algotrading programmers with diversified assets - not just the hottest options rumors on r/wallstreetbets

What stonksjs is not:

  • stonksjs is not a roboadvisor or professional trading app - this is just a fun little side project
  • stonksjs is not an unofficial API for Robinhood or any other brokerage. If that's what you're looking for, I'd recommend algotrader
  • stonksjs is not a backtesting tool, although that might get added to the roadmap soon

Usage

Installation, usage, and API docs can be found in each scoped package directory.

Name Description Version
@stonksjs/core Single point of entry for all stonksjs packages npm (scoped)
@stonksjs/quote Detailed, real-time stock quote data npm (scoped)
@stonksjs/finviz Unofficial finviz API npm (scoped)
@stonksjs/stock-screener Pre-defined industry standard stock screeners from MSN Money npm (scoped)

Development

Setup

Prerequisites

This project requires node v16.20.1.

Installation

Clone the repo and install the dependencies:

git clone http://github.com/nielse63/stonksjs.git
cd stonksjs
nvm use
npm ci

Testing

Tests are run using jest, and can be run by executing:

npm test

# run with coverage
npm test -- --coverage

Release

To release a new version, run:

npm run release

This executes lerna publish behind the scenes, and you'll be prompted with a few questions before the package is deployed.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Roadmap

All new features and changes are being tracked in GitHub under the projects and issues tabs of this repo.

stonksjs's People

Contributors

actions-user avatar dependabot[bot] avatar depfu[bot] avatar nielse63 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stonksjs's Issues

Refactor `stock-screener` lib

The file packages/stock-screener/lib/StockScreener.js doesn't need to be written as a class - it's simple enough that it can be written in basic functions

Refactor api module

The api module should export a plain object with a few basic method:

const api = require('@stonksjs/api');

// api.get(url, option) => {Promise<Object>}
// api.post(url, option) => {Promise<Object>} ?

The object methods only need to normalize the config passed to axios, parses/formats the response, and communicates errors to the user.

Setup codecov

Setup codecov account once automated testing is complete

Dependent on #3

Generate test script

Create a bin script to automatically generate new tests for source files that don't have an assodiated .spec.js file

Deploy script

Create a script that executes all the steps for a release

Module not found: Can't resolve '@stonksjs/finviz'

Describe the bug
Module not found: Can't resolve '@stonksjs/finviz'

To Reproduce

  1. npm i @stonksjs/finviz
  2. npx create-next-app@latest (select Javascript and and other params by default)
  3. add to app\page.js
    import Image from "next/image";
    import finviz from '@stonksjs/finviz';

export default async function Home() {
const data = await finviz.getQuote('MSFT');
console.log(data)
return (
... omitted for brevity

Expected behavior
I expected to see Microsoft company data in the console

Environment
NodeJS 20.14.0
NextJS 14.2.3

GitHub Actions

Create GitHub Actions to automate testing on push/pull requests

Screener returns an empty array

Describe the bug A clear and concise description of what the bug is.

Please forgive me if I am missing something obvious, I am relatively new to programming.

Passing the example screen (https://finviz.com/screener.ashx?v=111&s=ta_topgainers) to finviz.screen() returns a promise that resolves to an empty array.

To Reproduce Steps to reproduce the behavior:

My code:

const finviz = require("@stonksjs/finviz");

const getTopGainers = async () => {
  const symbols = await finviz.screener(
    "https://finviz.com/screener.ashx?v=111&s=ta_topgainers"
  );
  console.log(symbols);
};

getTopGainers();

// => []

My package.json:

{
  "name": "alpaca-trades",
  "version": "1.0.0",
  "description": "backend for sending requests to alpaca",
  "main": "index.js",
  "dependencies": {
    "@stonksjs/finviz": "^1.0.1",
    "node-fetch": "^2.6.1"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Expected behavior A clear and concise description of what you expected to happen.

Expect it to return an array of symbol in the response schema as described on npm

Environment A concise description of your environment: GatorGrader version, python version,
operating system, etc.

node v15.0.1
npm v6.14.11
macOS 10.15.7

Additional context Add any other context about the problem here.

Refactor `quote` module

The quote module doesn't need to be a class - instead, just import @stonksjs/finviz as a dependency and treat this module as a passthrough

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.