Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/barchart/portfolio-api-common
Shared JavaScript code for the Barchart Portfolio Service (client and server)
https://github.com/barchart/portfolio-api-common
javascript library portfolio public-repository
Last synced: 11 days ago
JSON representation
Shared JavaScript code for the Barchart Portfolio Service (client and server)
- Host: GitHub
- URL: https://github.com/barchart/portfolio-api-common
- Owner: barchart
- License: other
- Created: 2018-02-27T14:41:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-22T16:01:20.000Z (8 months ago)
- Last Synced: 2024-03-22T17:28:13.320Z (8 months ago)
- Topics: javascript, library, portfolio, public-repository
- Language: JavaScript
- Homepage:
- Size: 1.62 MB
- Stars: 1
- Watchers: 13
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @barchart/portfolio-api-common
[![AWS CodeBuild](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiSXBJTDZKWVFmSGVOSG9XQUgwbzB3Um5BZ0JsN2h1U3NQNWNhZTRHMlJKTVpEVVlVMENPaEFmR0NYS29rSStZWmZ5M1d0YVh2eXErVGhiekFtdHBpVmhJPSIsIml2UGFyYW1ldGVyU3BlYyI6ImROM3ZLMURwaXFyekltdDYiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)](https://github.com/barchart/portfolio-api-common)
[![NPM](https://img.shields.io/npm/v/@barchart/portfolio-api-common)](https://www.npmjs.com/package/@barchart/portfolio-api-common)A *public* library of shared JavaScript code used by Barchart's paper-trading portfolio system.
### Overview
Simply put, this project contains code that runs on both the servers (i.e. Serverless applications) and clients (e.g. browser, mobile, etc).
#### [/lib/serialization](https://github.com/barchart/portfolio-api-common/tree/master/lib/serialization)
Data is passed between client and server in JSON format. However, the code works with more complex types. For example, [```Decimal```](https://github.com/barchart/barchart-common-js/blob/master/lang/Decimal.js) instances are used in place of [native JavaScript floats](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) and [```Day```](https://github.com/barchart/barchart-common-js/blob/master/lang/Day.js) instances are used instead of [native JavaScript Dates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).
So, before data is exchanged, it must be converted to pure JSON. Conversely, when data is received, as pure JSON, its translated into more complex types before use. This is facilitated by the [```Schema```](https://github.com/barchart/barchart-common-js/blob/master/serialization/json/Schema.js) definitions which build custom "reviver" functions for [JSON parsing](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
#### [/lib/processing](https://github.com/barchart/portfolio-api-common/tree/master/lib/processing)
For reporting and display purposes, positions can be grouped together (by asset class, by portfolio, by user, etc). This code supports aggregation and gain/loss calculation. It is used by server-generated reports and dynamic user interfaces.
### Notable Consumers
* [@barchart/aws-lambda-portfolio](https://github.com/barchart/aws-lambda-portfolio) - Serverless applications (i.e. the backend)
* [@barchart/portfolio-client-js](https://github.com/barchart/portfolio-client-js) - JavaScript SDK for communicating with the backend### Package Managers
This library has been published as a *public* module to NPM as [@barchart/portfolio-api-common](https://www.npmjs.com/package/@barchart/portfolio-api-common).
```shell
npm install @barchart/portfolio-api-common -S
```