2020-12-12 20:18:25 +00:00
|
|
|
import React from "react";
|
|
|
|
import ReactDOM from "react-dom";
|
|
|
|
import "bootstrap/dist/css/bootstrap.css";
|
|
|
|
import App from "./components/App";
|
|
|
|
import io from "socket.io-client";
|
|
|
|
|
2020-12-13 19:32:33 +00:00
|
|
|
export const socket = io();
|
|
|
|
|
2020-12-14 14:50:31 +00:00
|
|
|
|
|
|
|
export type PositionState = {
|
|
|
|
id: number,
|
2020-12-14 20:26:14 +00:00
|
|
|
state: string,
|
2020-12-14 19:04:04 +00:00
|
|
|
base_price: number,
|
2020-12-16 09:44:25 +00:00
|
|
|
amount: number,
|
2020-12-14 14:50:31 +00:00
|
|
|
symbol: string,
|
|
|
|
profit_loss: number,
|
|
|
|
profit_loss_percentage: number
|
2020-12-13 19:32:33 +00:00
|
|
|
}
|
2020-12-12 20:18:25 +00:00
|
|
|
|
2020-12-16 11:27:10 +00:00
|
|
|
export type FirstConnectMessage = {
|
|
|
|
ticks: Array<number>,
|
|
|
|
prices: Array<number>,
|
|
|
|
positions: Array<PositionState>
|
|
|
|
}
|
|
|
|
|
2020-12-16 12:02:50 +00:00
|
|
|
export type NewEventMessage = {
|
|
|
|
tick: number,
|
|
|
|
kind: string,
|
|
|
|
}
|
|
|
|
|
2020-12-16 11:27:10 +00:00
|
|
|
export type NewTickMessage = {
|
|
|
|
tick: number,
|
|
|
|
price: number,
|
|
|
|
positions: Array<PositionState>
|
|
|
|
}
|
|
|
|
|
2020-12-16 10:18:57 +00:00
|
|
|
export type PositionCloseMessage = {
|
|
|
|
message_name: string,
|
|
|
|
position_id: number,
|
|
|
|
}
|
|
|
|
|
2020-12-12 20:18:25 +00:00
|
|
|
socket.on("connect", function () {
|
|
|
|
console.log("Connected!")
|
|
|
|
})
|
|
|
|
|
2020-12-14 18:52:43 +00:00
|
|
|
ReactDOM.render(<App/>, document.getElementById("root"));
|