Hot= publish(), cold=hot replay(), hot connect, cold connect
private void SetupReplayObservable()
{
var HotObservable = Observable.FromEvent(
h => _Manager.DataReceived += h,
h => _Manager.DataReceived -= h).Publish();
InfoObservable = HotObservable.Replay();
HotObservable.Connect();
InfoObservable.Connect();
}
Saturday, October 15, 2016
Rx Replay
Sunday, October 9, 2016
What are the frequency of HFT
Some data collected for High Frequency Trading: penny made each, 40 Million per day=> 1.5 Trades per ms =>42M per 7 hour period(9:30-4:30) HFT account for 70% trades in the market, use to be only 30%. At open Citadel executed 20M shares in 3 minutes --- HFT and Market Maker, 14% of Market trades
Saturday, October 8, 2016
Set Up IDE to compile C++17 code constexpr with statement, recursion in body
(1) VS 2015 cannot compile constexpr with statement body.
(2) Eclipse CDT (C++ dev tool) can but need the following install/setup/config
(3) cdt need compiler and cygwin64 must be installed (latest version 2.6.0)
(4) C++ 17 is supported in 2.6.0 but may not be supported in MinGW.
(5) during cygwin64 install to c:\cygwin64, must install package under devel--gcc,g++, make, gdb
(6) cdt download is cdt 9.1.0 =Eclipse neon 1.
(7) windows->preference->C/C++->Environment add path c:\cygwin64\bin
(8) project ->properties->C/C++ build ->Toolchain Editor ->Current Toolchain=CygWin gcc, builder=CDT internal builder
(9) same as (8), C++ compiler->settings->includes "C:\cygwin64\lib\gcc\x86_64-w64-mingw32\5.4.0\include"
(10) same as (9) C++ compiler->misc->other flag -std=c++17
(11) project ->C/C++ index -> rebuild/search/un-resolved can help to find out why some include are not found
(12) right click on a project can also access properties
#include <iostream>
#include <cmath>
using namespace std;
constexpr bool is_prime(int i)
{
if (i == 1) return false;
if (i % 2 == 0)
return i == 2;
double max_check =sqrt(i) + 1;
for (int j = 3; j < max_check; j += 2)
if (i%j == 0) return false;
return true;
}
using namespace std;
int main() {
cout << "test " <<is_prime(67)<< endl;
return 0;
}
contexpr with recursion and new if statement
constexpr bool is_prime2(int i, int div)
{
return div>=i?true:(i%div==0?false:is_prime2(i,div+2));
}
constexpr bool is_prime(int i)
{
return i==1?false:(i%2==0?i==2:is_prime2(i,3));
}
Dependency Walker for .Net
No such thing exactly but the following tools are close: git https://github.com/mikehadlow/AsmSpy open in VS 2012, restore missing packages (maybe Install-Package Microsoft.Extensions.CommandLineUtils) maybe working in CS 2013. copy AsmSpy, etc in /bin to App asmspy . all >refList.txt other tools http://www.amberfish.net/ http://www.ndepend.com/
Thursday, October 6, 2016
template fibonacci
template<long n>
struct fibonacci {
static const long value = fibonacci<n - 1>::value + fibonacci<n - 2>::value;
};
template<> struct fibonacci<1> { static const long value = 1; };
template<> struct fibonacci<2> { static const long value = 1; };
Wednesday, October 5, 2016
Specialization Template
#include "stdafx.h"
template<int i> struct D { D(void*); operator int(); };
template<int p, int i> struct is_prime {
enum {prim=(p==2) ||(p%i)&&is_prime<(i>2?p:0),i-1>::prim };
};
template<> struct is_prime<0,0> { enum { prim = 1 }; };
template<> struct is_prime<0,1> { enum { prim = 1 }; };
int main()
{
auto p = is_prime<243, 20>::prim;
return 0;
}
Subscribe to:
Posts (Atom)