Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Commit

Permalink
Created monitor/dashboard
Browse files Browse the repository at this point in the history
Created tick database
  • Loading branch information
Ameobea committed Oct 28, 2015
1 parent 6d75100 commit 84df41e
Show file tree
Hide file tree
Showing 2,455 changed files with 432,311 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
archives/*
tick_data/*
tick_database/helpers/conf.js
3 changes: 3 additions & 0 deletions algo_core/app.js
Expand Up @@ -28,6 +28,9 @@ socket.on("error", function(err){
console.log("Error in simulation injection socket: ");
console.log(err);
});
socket.on("text", function(text){ //TODO: Set handlers for different data types being sent back.
console.log(text);
});

// development error handler
// will print stacktrace
Expand Down
9 changes: 8 additions & 1 deletion apr_ref.txt
Expand Up @@ -10,4 +10,11 @@
description: Reads in historical data from CSV into the websocket at simulated real-time speed based on the time between the recorded ticks.
pair: Currency pair to backtest (EURUSD, GBPUSD, etc.)
start time: Unix timestamp at which to start the simulation (1399092584.5)
example: http://52.91.212.83:3000/backtest/live/USDRUB/1399092584.5
example: http://52.91.212.83:3000/backtest/live/USDRUB/1399092584.5

==Websocket protocol==
-All data JSON-encoded.
-Each packet contains a type identifier and data. //{"type":"new_tick","data":{"timestamp":1399097279.29,"ask":0.926,"bid":0.92593}}
-Packet types:
*new_tick - contains a raw tick from the tick source. These are live and as recent as it comes.
*
53 changes: 53 additions & 0 deletions monitor/app.js
@@ -0,0 +1,53 @@
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var ws = require("nodejs-websocket");
var fs = require('fs');
var http = require('http');

var index = require('./routes/index');

var app = express();

// view engine setup
app.engine('html', require('ejs').renderFile);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.listen(3002)
console.log("Monitor server started!");

app.use(logger('dev'));
app.use(cookieParser());

app.use('/', index);

// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
console.log(err.stack);
res.render('error', {
message: err.message,
error: err
});
});
}

// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});

app.use(function(req, res, next) {
res.status(404).send('Resource not found');
});

module.exports = app;
4 changes: 4 additions & 0 deletions monitor/helpers/util.js
@@ -0,0 +1,4 @@
var ws = require("nodejs-websocket");
var fs = require('fs');

var util = exports;
1 change: 1 addition & 0 deletions monitor/node_modules/.bin/jade

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 84df41e

Please sign in to comment.