Skip to content

Instantly share code, notes, and snippets.

View tomas-rampas's full-sized avatar
💻
CMaking...

Tomas Rampas tomas-rampas

💻
CMaking...
  • Prague, Czech Republic
  • 15:38 (UTC +02:00)
View GitHub Profile
@tomas-rampas
tomas-rampas / app.config
Created November 10, 2014 07:27
Proxying WCF service
<!--
Part of WCF application host config file
WCF communication is proxying via locahost:8888
-->
<system.net>
<defaultProxy enabled = "true" useDefaultCredentials = "true">
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" />
</defaultProxy>
</system.net>
# Donchian Channel
def donchian(df, n):
i = df.index[-1] - 1
dcuarr = [float('NaN')] * df.index[-1]
dclarr = [float('NaN')] * df.index[-1]
while i - n >= 0:
dcupper = max(df['High'].ix[i - n:i])
dclower = min(df['Low'].ix[i-n:i])
dcuarr[i] = dcupper
@tomas-rampas
tomas-rampas / corr.r
Last active November 8, 2015 20:25
Correlation Sample
require(chron)
require(Hmisc)
require(ggplot2)
#this function creates and returns date time for indexing purposes later
f = function(d, t) as.chron(paste(strptime(d, "%Y.%m.%d"), t))
#path to data, change for pointing your repository
path <- "G://TickData//"
#suffix of the file names with extension
suffix <- "_UTC+0_00_noweekends_fxmtf.csv"
library(quantmod)
library(zoo)
library(chron)
#following section loads "Systematic Investor Toolbox"
setInternet2(TRUE)
con <- gzcon(url('https://github.com/systematicinvestor/SIT/raw/master/sit.gz', 'rb'))
source(con)
close(con)
#reads ticks and creates .rda file
library(xts)
library(zoo)
library(blotter)
symbol = "GBPJPY"
tick.data.dir <- paste0('g:\\JForex\\data\\', symbol)
tick.data.outdir <- "g:\\TickData\\"
# this gist anticipates following:
# existence of GBPJPY.csv with OHLC series in g:\TickData directory
# time series having date time in format %d.%m.%Y %H:%M:%S
# update above assumptions in accordance with your dataset
library(blotter)
symbol = "GBPJPY"
import com.dukascopy.api.*;
import org.rosuda.JRI.REXP;
import org.rosuda.JRI.Rengine;
/**
* Created by tomas on 8/17/2016.
*/
public class JRITestStrategy implements IStrategy {
@Override
# coding=utf-8
import time
import struct
f = open(r'\\.\pipe\NPtest', 'r+b', 0)
i = 1
while True:
s = 'Message[{0}]'.format(i)
static void Main()
{
var server = new NamedPipeServerStream("NPtest");
Console.WriteLine("Waiting for connection...");
server.WaitForConnection();
Console.WriteLine("Connected.");
var br = new BinaryReader(server);
var bw = new BinaryWriter(server);
@tomas-rampas
tomas-rampas / keras_prediction.py
Created November 17, 2016 16:07 — forked from hnykda/keras_prediction.py
Predicting sequences of vectors (regression) in Keras using RNN - LSTM (danielhnyk.cz)
import pandas as pd
from random import random
flow = (list(range(1,10,1)) + list(range(10,1,-1)))*100
pdata = pd.DataFrame({"a":flow, "b":flow})
pdata.b = pdata.b.shift(9)
data = pdata.iloc[10:] * random() # some noise
import numpy as np