Skip to content

hassey13/SecuritiesServerMock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data API

I have created a class to provide you data like a server might.

Methods:

import {ServerMock} from 'securitiesservermock/ServerMock';

ServerMock.getAllSecurities // returns a Promise that resolves to an array of all securities (stocks) supported in the mock server

    [
        { id: 1, name: 'Apple Inc.', symbol: 'AAPL' },
        ...
    ]

ServerMock.getEquity // returns a Promise that resolves to an object with current user's equity data

    { cash: 3255.23 }

ServerMock.getPortfolio // returns a Promise that resolves to an array of portfolio securities (stocks)

    [
        { id: 1, name: 'Apple Inc.', symbol: 'AAPL', shares: 4, cost_basis: 102.24 },
        ...
    ]

ServerMock.getSecurityPrices // returns a Promise that resolves to a lookup security (stock) pricing data

    {
        1: { id: 1, name: 'Apple Inc.', symbol: 'AAPL', current_price: 122.42, current_price_change: 1.12, current_price_change_percent: .0087, prev_close_price: <float>, open_price: : <float> },
        ...
    }

Jargon:

cost_basis = average price the shares of the stock were purchased at security/securities = stock/s

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published