New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

robinhood-typescript

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

robinhood-typescript - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/models/fundamentals.d.ts

2

lib/index.d.ts
import { AccountsLoaded } from './models/account';
import { FundamentalsLoaded } from './models/fundamentals';
declare class RobinhoodAPI {

@@ -9,3 +10,4 @@ private _authToken;

account(): Promise<AccountsLoaded>;
fundamentals(ticker: string): Promise<FundamentalsLoaded>;
}
export default RobinhoodAPI;

@@ -53,3 +53,18 @@ "use strict";

}
// This will pull info on any individual ticker.
// User needs to input a comma btwn each string.
async fundamentals(ticker) {
const config = {
headers: { Authorization: `Bearer ${this._authToken}` },
};
const symbol = ticker.replace(/\s+/g, '');
try {
const response = await axios_1.default.get(`${defaults_1.apiUrl}${defaults_1.endpoints.fundamentals}?symbols=${symbol}`, config);
return response.data;
}
catch (error) {
return error;
}
}
}
exports.default = RobinhoodAPI;

2

package.json
{
"name": "robinhood-typescript",
"version": "1.1.0",
"version": "1.2.0",
"description": "NodeJS Framework to make trades with the private Robinhood API. Using this API is not encouraged, since it's not officially available and it has been reverse engineered. See @Sanko's Unofficial Documentation for more information.",

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

@@ -120,1 +120,54 @@ import RobinhoodAPI from '../index';

});
describe('Fundamentals', () => {
test('successful retrieve fundamentals infromation', async () => {
const api = new RobinhoodAPI('token');
const data = {
results: [
{
open: '199.760000',
high: '199.870000',
low: '194.880000',
volume: '54675610.000000',
average_volume_2_weeks: '39302667.100000',
average_volume: '39302667.100000',
high_52_weeks: '203.950000',
dividend_yield: '1.005860',
float: '7470659080.320000',
low_52_weeks: '130.780000',
market_cap: '1488856775200.000000',
pb_ratio: '13.114300',
pe_ratio: '32.943100',
shares_outstanding: '7583440000.000000',
description:
'Microsoft Corp. engages in the development and support of software, services, devices, and solutions. It operates through the following business segments: Productivity and Business Processes; Intelligent Cloud; and More Personal Computing. The Productivity and Business Processes segment comprises products and services in the portfolio of productivity, communication, and information services of the company spanning a variety of devices and platform. The Intelligent Cloud segment refers to the public, private, and hybrid serve products and cloud services of the company which can power modern business. The More Personal Computing segment encompasses products and services geared towards the interests of end users, developers, and IT professionals across all devices. The firm also offers operating systems; cross-device productivity applications; server applications; business solution applications; desktop and server management tools; software development tools; video games; personal computers, tablets; gaming and entertainment consoles; other intelligent devices; and related accessories. The company was founded by Paul Gardner Allen and William Henry Gates III in 1975 and is headquartered in Redmond, WA.',
instrument: 'https://api.robinhood.com/instruments/50810c35-d215-4866-9758-0ada4ac79ffa/',
ceo: 'Satya Nadella',
headquarters_city: 'Redmond',
headquarters_state: 'Washington',
sector: 'Technology Services',
industry: 'Packaged Software',
num_employees: 144000,
year_founded: 1975,
},
],
};
mockedAxios.get.mockResolvedValue({ data });
const fundamentalsInfo = await api.fundamentals('MSFT');
expect(fundamentalsInfo).toEqual(data);
});
test('failure to retrieve fundamentals infromation', async () => {
const api = new RobinhoodAPI('token');
const errorMessage = 'this sysmbol bad';
mockedAxios.get.mockRejectedValue({ errorMessage });
const fundamentalsInfo = await api.fundamentals('askdlfja;lsk');
expect(fundamentalsInfo).toEqual({ errorMessage });
});
});

@@ -6,2 +6,3 @@ import { apiUrl, endpoints } from './models/defaults';

import axios, { AxiosResponse } from 'axios';
import { FundamentalsLoaded } from './models/fundamentals';

@@ -60,4 +61,24 @@ class RobinhoodAPI {

}
// This will pull info on any individual ticker.
// User needs to input a comma btwn each string.
async fundamentals(ticker: string): Promise<FundamentalsLoaded> {
const config = {
headers: { Authorization: `Bearer ${this._authToken}` },
};
const symbol = ticker.replace(/\s+/g, '');
try {
const response: AxiosResponse<FundamentalsLoaded> = await axios.get(
`${apiUrl}${endpoints.fundamentals}?symbols=${symbol}`,
config,
);
return response.data;
} catch (error) {
return error;
}
}
}
export default RobinhoodAPI;

Sorry, the diff of this file is too big to display

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