Skip to content

femtotrader/DukascopyTicksReader.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DukascopyTicksReader

Build Status Build status

Installation

julia> Pkg.clone("https://github.com/femtotrader/DukascopyTicksReader.jl")

Usage

julia> using DukascopyTicksReader: get, DukascopyTicks, to_dataframe, to_timearray

julia> source = DukascopyTicks()
DukascopyTicksReader.DukascopyTicks(DukascopyTicksReader.CacheDirectory(""))

julia> reader = get(DukascopyTicks(), "EURUSD", DateTime(2016, 3, 28, 0, 40))
get EURUSD for 2016-03-28T00:40:00 from fname=~/data/dukascopy/ticks/2016/2016-03/2016-03-28/2016-03-28_000000/EURUSD.bi5
DukascopyTicksReader.TickReader("~/data/dukascopy/ticks/2016/2016-03/2016-03-28/2016-03-28_000000/EURUSD.bi5",LibArchive.Reader{LibArchive.ReadFileName{UTF8String}}(LibArchive.ReadFileName{UTF8String}("~/data/dukascopy/ticks/2016/2016-03/2016-03-28/2016-03-28_000000/EURUSD.bi5",10240),Ptr{Void} @0x00007fbcfbcf7800,true),DukascopyTicksReader.TickIter{Base.AbstractIOBuffer{Array{UInt8,1}}}(IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=53000, maxsize=Inf, ptr=1, mark=-1),(anonymous function),2016-03-28T00:00:00,0x0000000000000005))

julia> to_dataframe(reader)
2650×5 DataFrames.DataFrame
│ Row  │ Date                    │ Ask     │ Bid     │ AskVolume │ BidVolume │
├──────┼─────────────────────────┼─────────┼─────────┼───────────┼───────────┤
│ 12016-03-28T00:00:00.3351.132671.132641.01.47      │
│ 22016-03-28T00:00:00.7651.132691.132661.02.25      │
│ 32016-03-28T00:00:01.1191.132681.132641.01.91      │
│ 42016-03-28T00:00:02.7391.132671.132621.02.85      │
│ 52016-03-28T00:00:03.2831.132661.132621.01.35      │
│ 62016-03-28T00:00:03.8011.132651.132621.01.29      │
│ 72016-03-28T00:00:04.3111.132661.132621.01.35      │
│ 82016-03-28T00:00:05.2561.132651.132611.01.35      │
│ 92016-03-28T00:00:06.4241.132651.13261.03.7926412016-03-28T00:59:48.5171.131071.131041.04.06      │
│ 26422016-03-28T00:59:48.8211.131061.131041.03.5       │
│ 26432016-03-28T00:59:50.0571.131061.131031.06.19      │
│ 26442016-03-28T00:59:50.4131.131061.131031.01.5       │
│ 26452016-03-28T00:59:51.4341.131061.131031.03.19      │
│ 26462016-03-28T00:59:51.941.131061.131031.02.25      │
│ 26472016-03-28T00:59:54.9991.131061.131021.04.2       │
│ 26482016-03-28T00:59:55.4381.131041.131021.04.39      │
│ 26492016-03-28T00:59:56.251.131051.131021.01.95      │
│ 26502016-03-28T00:59:59.9441.131041.131021.01.5       │

julia> to_timearray(reader)
2650x4 TimeSeries.TimeArray{Float64,2,DateTime,Array{Float64,2}} 2016-03-28T00:00:00.335 to 2016-03-28T00:59:59.944

                          Ask     Bid     AskVolume  BidVolume
2016-03-28T00:00:00.335 | 1.1327  1.1326  1.0        1.47
2016-03-28T00:00:00.765 | 1.1327  1.1327  1.0        2.25
2016-03-28T00:00:01.119 | 1.1327  1.1326  1.0        1.91
2016-03-28T00:00:02.739 | 1.1327  1.1326  1.0        2.85

2016-03-28T00:59:54.999 | 1.1311  1.131   1.0        4.2
2016-03-28T00:59:55.438 | 1.131   1.131   1.0        4.39
2016-03-28T00:59:56.25 | 1.1311  1.131   1.0        1.95
2016-03-28T00:59:59.944 | 1.131   1.131   1.0        1.5
``