Giter Site home page Giter Site logo

rise-financial's Introduction

Financial Web Component Circle CI

Introduction

rise-financial is a Polymer Web Component that works together with the Rise Vision Financial Selector, a web app for managing financial content. It retrieves the financial list and its corresponding instruments from Firebase. Data is refreshed in realtime, so any changes that are made to a particular financial list in the Financial Selector are immediately propagated to the rise-financial component.

Usage

To use rise-financial, you should first install it using Bower:

bower install https://github.com/Rise-Vision/rise-financial.git

Next, construct your HTML page. You should include webcomponents-lite.min.js before any code that touches the DOM, and load the web component using an HTML import.

Example

<!DOCTYPE html>
<html>
  <head>
    <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
    <link rel="import" href="bower_components/rise-financial/rise-financial.html">
  </head>
  <body>
    <rise-financial
      id="myListID"
      financial-list="my-list"
      instrument-fields='["instrument", "name", "lastPrice", "netChange"]'>
    </rise-financial>

    <script>
      // Listen for "WebComponentsReady" event.
      window.addEventListener( "WebComponentsReady", function( e ) {
        const financial = document.querySelector( "rise-financial" );

        financial.addEventListener( "rise-financial-response", ( e ) => {
          console.log( e.detail );
        } );

        financial.addEventListener( "rise-financial-no-data", ( e ) => {
          console.log( "No data available" );
        } );

        // Request the financial data.
        financial.go();
      });
    </script>
  </body>
</html>

Realtime Data

To request realtime data, the type attribute can either be left off or it can be set to realtime.

Valid values for the instrument-fields attribute for realtime data are: accumulatedVolume, ask, bid, code, dayHigh, dayLow, daysOfWeek, endTime, historicClose, instrument, lastPrice, name, netChange, percentChange, startTime, timeZone, timeZoneOffset, tradeTime, updateInterval, yearHigh, yearLow, yield logoURL and yieldChange.

If no instrument-fields attribute is provided, all fields are returned by default.

Example

<rise-financial
  financial-list="my-list"
  instrument-fields='["instrument", "name"]'>
</rise-financial>

Historical Data

To request historical data, the type attribute must be set to historical and duration must be set to one of: Day, Week, 1M, 3M, 6M, 1Y or 5Y.

Valid values for the instrument-fields attribute for historical data are: accumulatedVolume, closePrice, intervalVolume, percentChange and tradeTime.

If no instrument-fields attribute is provided, all fields are returned by default.

In case the list of instruments contains more than one instrument an attribute symbol can be set to specify which instrument from the list the historical data needs to be retrieved.

Example

<rise-financial
  id = "myHistoricalID"
  duration="1M"
  financial-list="my-list"
  instrument-fields='["closePrice", "percentChange"]'
  type="historical"
  symbol="AAPL.O">
</rise-financial>

Response Object

rise-financial returns an object of the following format:

rise-financial data

data is an object with cols and rows properties, where cols is an array that contains additional information about the requested fields, and rows is an array that contains the actual data.

instruments is an object that provides details about every instrument found in the financial list.

Documentation

For further documentation on rise-financial attributes, methods, usage, and a comprehensive demo, please see here.

Built With

Development

Dependencies

  • Git - Git is a free and open source distributed version control system that is used to manage our source code on Github.
  • npm & Node.js - npm is the default package manager for Node.js. npm runs through the command line and manages dependencies for an application. These dependencies are listed in the package.json file.
  • Bower - Bower is a package manager for Javascript libraries and frameworks. All third-party Javascript dependencies are listed in the bower.json file.
  • Gulp - Gulp is a Javascript task runner. It lints, runs unit and E2E (end-to-end) tests, minimizes files, etc. Gulp tasks are defined in gulpfile.js.
  • Polyserve - A simple web server for using bower components locally.

Local Development Environment Setup and Installation

To make changes to the web component, you'll first need to install the dependencies:

  • Git
  • Node.js and npm
  • Bower - To install Bower, run the following command in Terminal: npm install -g bower. Should you encounter any errors, try running the following command instead: sudo npm install -g bower.
  • Gulp - To install Gulp, run the following command in Terminal: npm install -g gulp. Should you encounter any errors, try running the following command instead: sudo npm install -g gulp.
  • Polyserve - To install Polyserve, run the following command in Terminal: npm install -g polyserve. Should you encounter any errors, try running the following command instead: sudo npm install -g polyserve.

The web components can now be installed by executing the following commands in Terminal:

git clone https://github.com/Rise-Vision/rise-financial.git
cd rise-financial
npm install
bower install

Run Locally

To access the demo locally, run the following command in Terminal: polyserve

Now in your browser, navigate to:

localhost:8080/components/rise-financial/demo/index.html

Testing

You can run the suite of tests either by command terminal or via a local web server using Polyserve.

Command Terminal

Execute the following command in Terminal to run tests:

NODE_ENV=test yarn run test

Local Server

Run the following command in Terminal: polyserve.

Now in your browser, navigate to:

localhost:8080/components/rise-financial/test/index.html

Deployment

Once you are satisifed with your changes, deploy the contents of the bower_components folder to a folder on your server and also create a rise-financial folder within your folder and upload rise-financial.html to it. You can then use the web component by following the Usage instructions.

Submitting Issues

If you encounter problems or find defects we really want to hear about them. If you could take the time to add them as issues to this Repository it would be most appreciated. When reporting issues, please use the following format where applicable:

Reproduction Steps

  1. did this
  2. then that
  3. followed by this (screenshots / video captures always help)

Expected Results

What you expected to happen.

Actual Results

What actually happened. (screenshots / video captures always help)

Contributing

All contributions are greatly appreciated and welcome! If you would first like to sound out your contribution ideas, please post your thoughts to our community, otherwise submit a pull request and we will do our best to incorporate it. Please be sure to submit test cases with your code changes where appropriate.

Resources

If you have any questions or problems, please don't hesitate to join our lively and responsive community at http://community.risevision.com.

If you are looking for user documentation on Rise Vision, please see https://help.risevision.com/user.

If you would like more information on developing applications for Rise Vision, please visit https://help.risevision.com/developer.

Facilitator

Stuart Lees

rise-financial's People

Contributors

donnapep avatar pcsandford avatar rodrigopavezi avatar settinghead avatar stulees avatar

Watchers

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

rise-financial's Issues

No data returned when first loaded - v2.0.7

What should happen

When using the component locally, we should be able to see live / dummy data when a webpage is first opened using the gulp, e.g. in the marketwall-charts repo.

What currently happens

After installing bower and npm and running gulp, the webpage will open but there is no data. The following error is shown in the console:
screen shot 2017-06-22 at 2 29 29 pm

Data will show only if the page is shown in an incognito window, but then the same error appears after a refresh.

Steps to recreate

Clone the marketwall-charts repo which uses version ^2.0.3 of the financial component. Run npm install, bower install and then gulp. The page will open but no data will be shown.

Thanks!

All financial data on legacy marketwalls is being returned with sample figures (1234.5)

What is the expected behavior?

Financial instruments return accurate financial data.

What is the actual behavior?

Financial data is returned on marketwalls that rely on the financial selector as dummy values, i.e. $1234.50.
Financial templates work as expected.

What steps can be taken to replicate the problem?

Show financial data using a legacy marketwall design.
I have an example of this I can share.

Adding 'financial-list' as an attribute in the HTML causes an error

What should happen

When the financial-list attribute is set in the component HTML it should target the financial list via the key provided when financial.go() is called.

What actually happens

When the financial-list attribute is set in the component HTML it results in the following error:
screen shot 2017-02-22 at 1 16 48 pm

However, if the financial-list is added as an attribute via the javascript (as in the new demo), the component works as expected.

Steps to recreate

Amend the files in the demo folder to include the financial-list attribute in the HTML and call financial.go()

Displays with several Financial presentations sporadically go blank.

#Expected Behaviour
As a user I expect the financial placeholder data to show up in the financial templates Rise offers, regardless of how many I add to my schedule, or their duration in the schedule.

#Actual Behaviour
Some presentations will show blank financial data, and appear to show the default background / logo, like they are not loading up financial content or branding info at all.

From first appearances, this appears to be due to capacity. In all cases I have tested this, they are on weaker machines, with several presentation templates, all showing for 45 - 55 seconds each.

#Client Instance in Production:
https://apps.risevision.com/schedules/details/231759db-2c19-454b-bfbc-1d382c4af185?cid=f4f293e6-cd68-4964-80e9-11ee945bfdaa

https://apps.risevision.com/schedules/details/93633362-5af5-47f4-8756-6b4be052c9af?cid=46e213a2-6dec-4d95-a672-98f47a5a98c7

Dynamically set duration brings back different data for 'tradeTime'

What currently happens

When the component is initialized on page load the historical data for tradeTime is in the following format: Tue Mar 07 2017 10:00:00 GMT-0500

However, when the duration is changed dynamically and a second request is sent, the tradeTime data is returned in the following format: 2017-03-07T15:00:00.000Z

If the component refreshes after 1min the tradeTime is returned as Tue Mar 07 2017 10:00:00 GMT-0500

What should happen

The tradeTime should be formatted as Tue Mar 07 2017 10:00:00 GMT-0500 when first initialized and also when the duration is dynamically changed and further calls are made.

Steps to replicate

Set up the component so that the duration is changed on button click.
On page load check the tradeTime format
Click the button to change to any other duration and check the tradeTime format

Interactive Marketwalls are not returning data in production

#Expected Behaviour
As a user I expect the financial placeholder data to show up in the interactive market wall template in the editor.

#Actual Behaviour
The interactive market wall does not load placeholder data in the editor of production apps. The financial data DOES appear in the production player and staging editor.

The templates are the same version 1.0.3 and are using the same instance of a financial component. https://widgets.risevision.com/stable/components/rise-data-financial/1/rise-data-financial.js

Production Editor (does load placeholder data): https://www.screencast.com/t/TdWOnu2Kcg

Player (loads data correctly): https://www.screencast.com/t/sKlY9we9G3EL
Staging Editor (loads placeholder data correctly) : https://www.screencast.com/t/e4zecopvXmV

Creative can update to use financial version 2 but it seems something else is going on as locally I can't get it to work changing to version 2 and as you see in staging version 1 still works.

@stulees and I initially thought this to be part of https://github.com/Rise-Vision/html-template-library/issues/2246. However, it looks like Alexey did fix all the 500 errors but the data does still not show up.
@alexey-rise Is this something you can take an initial look at during the next office hours and give your thoughts on if this is a continuation of the same issue? If this is something completely different it can probably wait until cool down given it doesn't affect player.

#Steps to Replicate
Add either one of the two interactive market walls to a production company.
Observe no data is working and there are no console errors.
https://apps.risevision.com/editor/add/interactive-marketwall_v1
https://apps.risevision.com/editor/add/interactive-marketwall-slides_v1

Client Instance in Production:
https://apps.risevision.com/templates/edit/61cc73e8-a45e-4d53-9ac6-96d1798c7739/?cid=c2a2ade1-f2fb-4be3-a821-66212d635afd

Example Staging Version: https://apps-stage-0.risevision.com/templates/edit/5209ee5c-0ee8-49bf-aa3c-c655439ed39d/?cid=7fa5ee92-7deb-450b-a8d5-e5ed648c575f

Dynamically changing the duration attribute of the component for historical data causes an error

What currently happens

When the type attribute is set to "historical" and the duration attribute is changed dynamically e.g. using jQuery to change it from "Day" to "1M" the component does not return the correct data when financial.go() is called and instead produces this error:
screen shot 2017-02-27 at 2 02 36 pm

What should happen

It should be possible to change the duration attribute and call financial.go() to get a new set of data.

Steps to reproduce

  1. Set up the component for historical data and set the duration = "Day"
  2. Using JS or jQuery change the duration attribute to "1M"
  3. The chart will not update with the month data and will show the above error instead

@stulees FYI

Thanks!

More than one historical instrument in a list returns no data

What currently happens

When more than one instrument is added to a list and this data is targeted with the component set to retrieve historical data, data is returned as 0 for values and null for strings. The attached screenshot shows the data returned for a list containing the Dow Jones and Nikkei indices. The instruments array appears to be correct, however the data.rows array is not.
screen shot 2017-03-14 at 10 05 00 am

I have tested both indices as single items on a list and the data is returned correctly. This is tested using v1.3.2 of the component

What should happen

The data object should be returning values in the same format as it does for current data as shown in the attached screenshot
screen shot 2017-03-14 at 10 32 11 am

Steps to recreate

Set up a list in the financial selector which contains more than one instrument
Target the list using the financial component and set type = "historical"
Console log the results to see that the the data.rows array does not contain the correct values

Thanks!

Correct data not showing on display

Issue

When using the financial component on an authorized display, the component still returns the dummy data e.g. lastChange showing as 1.234

Steps to Replicate

  1. Set up a list of financial instruments and the financial component and add this to a new presentation.
  2. Add the presentation to an authorized display and the dummy data is still visible.

Expected Results

The dummy data seen on the desktop version should be replaced by live data when shown on an authorized display

Error when more than one instance of component is used

What currently happens

When you add more than one instance of the component to the html you get the following error:
screen shot 2017-03-06 at 1 47 14 pm

What should happen

It should be possible to add more than one instance of the component to an html file, both for current and historical data.

###Steps to recreate

  1. Add two instances of the component to an html file.
  2. Even if only one instance is referenced in the JS, the above error will appear in the console.

Error when dynamically changing range and symbol for Historical Component

What currently happens:

When dynamically changing the date range in the historical component the following error appears:
screen shot 2017-10-19 at 9 56 25 am

We think this error may be effecting the display of historical data in the chart when the date range and symbol are dynamically changed. The result is that older data, e.g. from the previous selected instrument, will still be displayed.

What should happen

The error should not be displayed in console

When the date and symbol are dynamically changed by the user the correct historical data is returned by the component.

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.