Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@joemccann/robinhood-api

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@joemccann/robinhood-api - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

2

package.json
{
"name": "@joemccann/robinhood-api",
"version": "1.3.1",
"version": "1.4.0",
"description": "📈 Unofficial node.js package for the Robinhood.com API.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -81,7 +81,7 @@ const fetch = require('node-fetch')

const popularity = async ({ token = '', symbol = '' }) => {
const popularity = async ({ token = '', instrument = '' }) => {
if (!token) throw new Error('Missing required parameter "token"')
if (!symbol) throw new Error('Missing required parameter "symbol"')
if (!instrument) throw new Error('Missing required parameter "instrument"')
const URL = `https://api.robinhood.com/instruments/${symbol}/popularity`
const URL = `https://api.robinhood.com/instruments/${instrument}/popularity`

@@ -112,7 +112,6 @@ let resp = null

data = await resp.text()
data = await resp.json()
} catch (e) {
if (resp.status === 404) return { statusCode: 404 }
console.error(e.message)
throw e
console.error(e)
return { data: e.message, statusCode: resp.status }
}

@@ -119,0 +118,0 @@ return { data, statusCode: resp.status }

@@ -58,2 +58,21 @@ require('dotenv').config()

test('PASS: popularity', async t => {
const params = {
token,
instrument: instrumentUUID
}
try {
const { data, statusCode } = await popularity(params)
t.ok(data)
const { instrument = '', num_open_positions: num = 0 } = data
t.same(instrument, 'https://api.robinhood.com/instruments/450dfc6d-5510-4d40-abfb-f633b7d9be3e/')
t.true(num > 0)
t.equals(statusCode, 200)
} catch (e) {
console.error(e)
}
t.end()
})
/*
test('FAIL: quote', async t => {

@@ -60,0 +79,0 @@ const sym = 'CTST'

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc