Giter VIP home page Giter VIP logo

jpmc-tech-task-3-py3's People

Contributors

jbf-insidesherpa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

jpmc-tech-task-3-py3's Issues

Upload patch file size error

315 mb patch size giving error as only 250 mb is allowed . I downloaded the npm zip file externally and replaced in repo .
how to upload?

getting wrong output on webpage

Any help on how should I fix this output?

image

Code for Graph.tsx
`import React, { Component } from 'react';
import { Table } from '@jpmorganchase/perspective';
import { ServerRespond } from './DataStreamer';
import { DataManipulator } from './DataManipulator';
import './Graph.css';
interface IProps {
data: ServerRespond[],
}
interface PerspectiveViewerElement extends HTMLElement {
load: (table: Table) => void,
}
class Graph extends Component<IProps, {}> {
table: Table | undefined;
render() {
return React.createElement('perspective-viewer');
}
componentDidMount() {
// Get element from the DOM.
const elem = document.getElementsByTagName('perspective-viewer')[0] as unknown as PerspectiveViewerElement;
const schema = {
price_abc: 'float',
price_def: 'float',
ratio: 'float',
timestamp: 'date',
upper_bound: 'float',
lower_bound: 'float',
trigger_alert: 'float',
};

if (window.perspective && window.perspective.worker()) {
  this.table = window.perspective.worker().table(schema);
}
if (this.table) {
  // Load the `table` in the `<perspective-viewer>` DOM reference.
  elem.load(this.table);
  elem.setAttribute('view', 'y_line');
  elem.setAttribute('column-pivots', '["stock"]');
  elem.setAttribute('row-pivots', '["timestamp"]');
  elem.setAttribute('columns', '["top_ask_price"]');
  elem.setAttribute('aggregates', JSON.stringify({
    price_abc: 'avg',	
    price_def: 'avg',
    ratio: 'avg',
    timestamp: 'distinct count',
    upper_bound: 'avg',
    lower_bound: 'avg',
    trigger_alert: 'avg',
  }));
}

}

componentDidUpdate() {
if (this.table) {
this.table.update([
DataManipulator.generateRow(this.props.data),
]);
}
}
}

export default Graph;
`
Code for Datamanipulator.ts

`import { ServerRespond } from './DataStreamer';

export interface Row {
price_abc: number,
price_def: number,
ratio: number,
timestamp: Date,
upper_bound: number,
lower_bound: number,
trigger_alert: number | undefined,
}

export class DataManipulator {
static generateRow(serverRespond: ServerRespond[]): Row {
const priceABC = (serverRespond[0].top_ask.price + serverRespond[0].top_bid.price)/2;
const priceDEF = (serverRespond[1].top_ask.price + serverRespond[1].top_bid.price)/2;
const ratio = priceABC/priceDEF;
const upperBound = 1+0.05;
const lowerBound = 1-0.05;
return {
price_abc: priceABC,
price_def: priceDEF,
ratio,
timestamp: serverRespond[0].timestamp > serverRespond[1].timestamp ?
serverRespond[0].timestamp : serverRespond[1].timestamp,
upper_bound: upperBound,
lower_bound: lowerBound,
trigger_alert: (ratio > upperBound || ratio < lowerBound) ? ratio : undefined,
};
}
}
`

Clicking 'Start Streaming Data' shows no data

Hi, so I'm currently running Windows 10 and python 3. I went through the setup process for Task 3 and am now up to starting up the app. I ran npm install which gave me this:
image
image

I then ran npm start which gave me this:
image

The app successfully loads. However, when I click the button, no data shows up. The command line that is running the server doesn't output anything when I click the button. Any thoughts? Thanks.

Error while starting npm

[email protected] start C:\Abhi\JPMC-tech-task-3-PY3
react-scripts start

'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Abhishek Singh\AppData\Roaming\npm-cache_logs\2020-04-26T04_23_54_120Z-debug.log

when I write npm start command

C:/Users/Admin/JPMC-tech-task-3/src/Graph.tsx
Type error: Cannot find module '@jpmorganchase/perspective'. TS2307

1 | import React, { Component } from 'react';

2 | import { Table } from '@jpmorganchase/perspective';
| ^
3 | import { ServerRespond } from './DataStreamer';
4 | import { DataManipulator } from './DataManipulator';
5 | import './Graph.css';

NPM issue

Screenshot (90)
getting this type of error
what to do??

Problem with npm start

I downloaded node_modules and pasted it in my directory. But when I try to run npm start I get the following error

Screenshot (1)

Task3 error(Start streaming data)

In chrome:
Start streaming data,on clicking showing nothing
In explorer:
on clicking it shows:syntax error :json.parse error: unexpected input at position:0

Problem with graph.tsx


I was getting this error , then i changed Row[] to Row
as suggested in the issues of this task

Type '{ price_abc: number; price_def: number; ratio: number; timestamp: Date; upper_bound: number; lower_bound: number; trigger_alert: number | undefined; }' is not assignable to type 'Row[]'.
Object literal may only specify known properties, and 'price_abc' does not exist in type 'Row[]'. TS2322

21 |
22 |     return {

23 | price_abc:priceABC,
| ^
24 | price_def:priceDEF,
25 | ratio,
26 | timestamp:serverResponds[0].timestamp>serverResponds[1].timestamp ?


After changing I got this error...........

Type error: Argument of type 'Row' is not assignable to parameter of type 'TableData'.
Type 'Row' is not assignable to type '{ [key: string]: string; }'.
Index signature is missing in type 'Row'. TS2345

57 |     if (this.table) {
58 |       this.table.update(

59 | DataManipulator.generateRow(this.props.data),
| ^
60 | );
61 | }
62 | }

Issues with Row[]

During the compilation of my program, I was presented with the following error code,
**Type error: Type '{ price_abc: number; price_def: number; ratio: number; timestamp: Date; upper_bound: number; lower_bound: number; trigger_alert: number | undefined; }' is not assignable to type 'Row[]'.
Object literal may only specify known properties, and 'price_abc' does not exist in type 'Row[]'. TS2322

20 |     const lowerBound = 1 - 0.05;
21 |     return {

22 | price_abc: priceABC,
| ^
23 | price_def: priceDEF,
24 | ratio,
25 | timestamp: serverResponds[0].timestamp > serverResponds[1].timestamp ?

**
Through previous issue posts, I realised this was due to having square brackets after row, and so once they were removed, I ran into another issue within Graph.tsx:
**Type error: Argument of type 'Row' is not assignable to parameter of type 'TableData'.
Type 'Row' is not assignable to type '{ [key: string]: string; }'.
Index signature is missing in type 'Row'. TS2345

52 |     if (this.table) {
53 |       this.table.update(

54 | DataManipulator.generateRow(this.props.data),
| ^
55 | );
56 | }
57 | }**
I am unable to figure out how to fix this error, any help would be appreciated

Wrong Graph

I am getting this wrong graph after making all the required changes.
Please help
graph
datamodule
grap

error after clicking button

Hi, would anyone be able to offer any advice? I've closed and restarted the server multiple times, and am not getting any compiling errors. This occurs after I click on the "start streaming data" button.

Screen Shot 2020-07-16 at 8 14 14 PM

Anyone SuccessFul getting an Trigger Alert ?

Hello Guys,

Can anyone confirm with me that they have got a triggered alert on data ? I tried, it also depends on incoming data, but if anyone successful, can help me with it ?

Many thanks,
Mihir

TS2322

Type error: Type '{ price_abc: number; price_def: number; ratio: number; timestamp: Date; upper_bound: number; lower_bound: number; trigger_alert: number | undefined; }' is not assignable to type 'Row[]'.
Object literal may only specify known properties, and 'price_abc' does not exist in type 'Row[]'. TS2322

'react-scripts' is not recognized as an internal or external command, operable program or batch file.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!
C:\Users\AppData\Roaming\npm-cache_logs\2020-06-22T23_17_23_719Z-debug.log

Server Misfunction

not showing
When I click Start Streaming Data, nothing shoes.
The server just keeps returning continuous queries even when I just started without clicking Start Streaming

'Object literal may only specify known properties'

Hello,

I am currently getting the error:

"Type '{ price_abc: number; price_def: number; ratio: number; timestamp: Date; upper_bound: number; lower_bound: number; trigger_alert: number | undefined; }' is not assignable to type 'Row[]'.
Object literal may only specify known properties, and 'price_abc' does not exist in type 'Row[]'.ts(2322)"

in my generateRow() function.

I am not sure as to what could be causing this; my code is exactly the same as the code shown in the supplied pdf:

import { ServerRespond } from './DataStreamer';

export interface Row { // Match new schema
  price_abc: number,
  price_def: number,
  ratio: number,
  timestamp: Date,
  upper_bound: number,
  lower_bound: number,
  trigger_alert: number | undefined,
}


export class DataManipulator { // Process raw data; define necessary return information
  static generateRow(serverRespond: ServerRespond[]): Row[] {
    const priceABC = (serverRespond[0].top_ask.price + serverRespond[0].top_bid.price) / 2;
    const priceDEF = (serverRespond[1].top_ask.price + serverRespond[1].top_bid.price) / 2;
    const ratio = priceABC / priceDEF;
    const upperBound = 1 + 0.1;
    const lowerBound = 1 - 0.1;
    return {
        price_abc: priceABC,
        price_def: priceDEF,
        ratio,
        timestamp: serverRespond[0].timestamp > serverRespond[1].timestamp ?
          serverRespond[0].timestamp : serverRespond[1].timestamp,
        upper_bound: upperBound,
        lower_bound: lowerBound,
        trigger_alert: (ratio > upperBound || ratio < lowerBound) ? ratio: undefined,
      };
  }
}

ts 2322

C:/Users/GLOBAL/JPMC-tech-task-3-PY3/src/DataManipulator.ts
Type error: Type 'number | undefined' is not assignable to type 'number'.
Type 'undefined' is not assignable to type 'number'. TS2322

27 |       upper_bound: upperBound,
28 |       lower_bound: lowerBound,

29 | trigger_alert: (ratio > upperBound || ratio < lowerBound) ? ratio : undefined,
| ^
30 | };
31 | }
32 | }

Patch Size

I keep getting told my patch file is too large, but I only have what was asked of us. Does anyone have a solution?

Error when doing 'npm install' ... any ideas?

npm WARN tar ENOENT: no such file or directory, lstat '/home/andrew/Projects/JPMC-tech-task-3-PY3/node_modules/.staging/chalk-e3bf26b7/types'
npm WARN tar ENOENT: no such file or directory, open '/home/andrew/Projects/JPMC-tech-task-3-PY3/node_modules/.staging/postcss-18e8c038/lib/postcss.d.ts'
npm ERR! path /home/andrew/Projects/JPMC-tech-task-3-PY3/node_modules/.staging/supports-color-e4630f0b
npm ERR! code ENOSPC
npm ERR! errno -28
npm ERR! syscall mkdir
npm ERR! nospc ENOSPC: no space left on device, mkdir '/home/andrew/Projects/JPMC-tech-task-3-PY3/node_modules/.staging/supports-color-e4630f0b'
npm ERR! nospc There appears to be insufficient space on your system to finish.
npm ERR! nospc Clear up some disk space and try again.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/andrew/.npm/_logs/2020-07-04T06_00_36_071Z-debug.log

Sounds like a disk space problem but I am running a virtual machine (Xubuntu on Oracle VM VirtualBox) and have hardly any disk space used up.

npm not module not found

the npm is not getting installed .even checked for npm -v it also throws an error and the other commands-npm install and npm start also throw error.

Error in DataMaipulator.ts

After running the Node application after making all the changes this is the error I get:

./src/DataManipulator.ts
Attempted import error: 'ServerRespond' is not exported from './DataStreamer'.

client app failing to start in task 3

I have node v11.0.0 and npm v6.4.1.
when I tried to launch client app I am getting the following errors. I have also attached the log file

**'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\fatim\AppData\Roaming\npm-cache_logs\2019-11-05T18_01_07_085Z-debug.log
2019-11-05T18_01_07_085Z-debug.log
**

Type error: Cannot find name 'DataManipulator'. TS2304

Type error: Cannot find name 'DataManipulator'. TS2304

76 |     if (this.table) {
77 |       this.table.update([

78 | DataManipulator.generateRow(this.props.data),
| ^
79 | ]);
80 | }
81 | }
Can anyone help with this issue?
I really appreciate it!

Operator '+' cannot be applied to types 'Number' and 'Number'. TS2365

I have written this code on VSCode:

`import { ServerRespond } from './DataStreamer';

export interface Row {
price_abc: number,
price_def: number,
ratio: number,
timestamp: Date,
upper_bound: number,
lower_bound: number,
trigger_alert: number | undefined,
}

export class DataManipulator {
static generateRow(serverRespond: ServerRespond[]): Row {
const priceABC = (serverRespond[0].top_ask.price + serverRespond[0].top_bid.price) / 2;
const priceDEF = (serverRespond[1].top_ask.price + serverRespond[1].top_bid.price) / 2;
const ratio = priceABC / priceDEF;
const upperBound = 1 + 0.05;
const lowerBound = 1 - 0.05;
return {
price_abc: priceABC,
price_def: priceDEF,
ratio,
timestamp: serverRespond[0].timestamp > serverRespond[1].timestamp ?
serverRespond[0].timestamp : serverRespond[1].timestamp,
upper_bound: upperBound,
lower_bound: lowerBound,
trigger_alert: (ratio > upperBound || ratio < lowerBound) ? ratio : undefined,
}
}
}`

But the error comes out and saying this on the chrome browser:

Type error: Operator '+' cannot be applied to types 'Number' and 'Number'. TS2365

` 13 | export class DataManipulator {
14 | static generateRow(serverRespond: ServerRespond[]): Row {

15 | const priceABC = (serverRespond[0].top_ask.price + serverRespond[0].top_bid.price) / 2;
| ^
16 | const priceDEF = (serverRespond[1].top_ask.price + serverRespond[1].top_bid.price) / 2;
17 | const ratio = priceABC / priceDEF;
18 | const upperBound = 1 + 0.05;`

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.