Skip to content

Instantly share code, notes, and snippets.

@itsff
Created August 26, 2014 21:14
Show Gist options
  • Save itsff/258427d1827277ec24f9 to your computer and use it in GitHub Desktop.
Save itsff/258427d1827277ec24f9 to your computer and use it in GitHub Desktop.
Eugene
extern "C"
{
#define restrict __restrict
#include <ttsdk/whatever.h>
#include <ttsdk/order.h>
// ...
#include <fcntl.h>
}
#include <string>
#include <iostream>
#include <fstream>
<strategy name="TT Iceberg" uiRep="TT Iceberg" version="1.1" providerID="TT" entryFile="algo.so" algoVersion="1">
<hideFromUIComponents>
<uiComponent>Dashboard</uiComponent>
</hideFromUIComponents>
<parameter name="__instr_id"
type="String_t" />
<parameter name="__order_quantity"
type="Qty_t" />
<parameter name="__price"
type="Price_t"/>
<parameter name="__side"
type="Int_t"/>
<parameter name="__account"
type="String_t"/>
<!-- For now, hardcode parent to GTC -->
<parameter name="__tif"
type="Int_t"
constValue="2"/>
<parameter name="ChildTIF"
type="Int_t"
ttCustomValueType="__tif"/>
<!-- Icebergs are alywas limit orders-->
<parameter name="__type"
type="Int_t"
constValue="2"/>
<!-- display qty -->
<parameter name="DiscVal"
type="int_t"
minValue="1"
initValue="0"/>
<parameter name="DiscValType"
type="Int_t"
initValue="eQty" >
<enumPair enumID="eQty" wireValue="1"/>
<enumPair enumID="ePercent" wireValue="2"/>
</parameter>
<!-- TODO: Add Variance HERE -->
<!-- Relative price -->
<parameter name="LimitTicksAway"
type="int_t"
minValue="-999"
maxValue="999"
initValue="1"/>
<parameter name="LimitPriceType"
type="Int_t"
initValue="eLtp">
<enumPair enumID="eLtp" wireValue="3"/>
<enumPair enumID="eBid" wireValue="1"/>
<enumPair enumID="eAsk" wireValue="2"/>
</parameter>
<!-- trigger -->
<parameter name="TriggerType"
type="Int_t"
initValue="eStop">
<enumPair enumID="eStop" wireValue="1"/>
<enumPair enumID="eIT" wireValue="2"/>
</parameter>
<parameter name="__trigger_price"
type="Price_t"/>
<parameter name="TriggerPriceType"
type="Int_t"
initValue="eLtp">
<enumPair enumID="eLtp" wireValue="3"/>
<enumPair enumID="eBid" wireValue="1"/>
<enumPair enumID="eAsk" wireValue="2"/>
</parameter>
<parameter name="IsTrlTrg"
type="Boolean_t"
initValue="false"/>
<parameter name="TriggerTicksAway"
type="int_t"
initValue="3"
minValue="1"
maxValue="99"/>
<!-- Date and Time -->
<parameter name="STime"
type="utctimestamp_t"
initValueMode="1"
minval="{now}"/>
<parameter name="ETime"
type="utctimestamp_t"
initValue="0"
minval="{now}"/>
<parameter name="ETimeAct"
type="Int_t" >
<enumPair enumID="eCancel" wireValue="1"/>
<enumPair enumID="eGoToMarket" wireValue="2"/>
</parameter>
<strategyLayout>
<strategyPanel orientation="vertical">
<!-- Iceberg details (disclosed qty and relative price) -->
<strategyPanel class="header-block">
<control type="Label_t" label="Iceberg Details"> </control>
</strategyPanel>
<strategyPanel class="header-block" indent="true">
<!-- Disclosed qty -->
<row>
<control id="DisplayQty_ctrl"
parameterRef="DiscVal"
type="SingleSpinner_t"
label="Display"> </control>
<control id="DisplayQtyType_ctrl"
parameterRef="DiscValType"
type="DropDownList_t">
<listItem enumID="eQty" uiRep="Qty"/>
<listItem enumID="ePercent" uiRep="%"/>
</control>
</row>
<!-- Relative price -->
<strategyPanel name="LimitPriceOffsetPanel" orientation="horizontal">
<control id="LimitPriceOffsetAllowed"
label="Offset"
initValue="false"
type="CheckBox_t"> </control>
<control id="LimitPriceOffset_ctrl"
parameterRef="LimitTicksAway"
type="SingleSpinner_t">
<StateRule visible="true">
<edit field="LimitPriceOffsetAllowed" operator="EQ" value="true" />
</StateRule>
</control>
<control id="LimitPriceOffsetType_ctrl"
parameterRef="LimitPriceType"
type="DropDownList_t">
<StateRule visible="true">
<edit field="LimitPriceOffsetAllowed" operator="EQ" value="true" />
</StateRule>
<listItem enumID="eLtp" uiRep="LTP"/>
<listItem enumID="eBid" uiRep="Bid"/>
<listItem enumID="eAsk" uiRep="Ask"/>
</control>
</strategyPanel>
<control type="Spacer_t"> </control>
</strategyPanel>
<!-- Trigger -->
<strategyPanel class="header-block">
<strategyPanel orientation="horizontal">
<control id="Trigger"
label="Trigger"
initValue="false"
type="CheckBox_t"> </control>
<strategyPanel orientation="horizontal" indent="true">
<control id="TriggerOrderType_ctrl"
parameterRef="TriggerType"
type="DropDownList_t">
<StateRule visible="true">
<edit field="Trigger" operator="EQ" value="true" />
</StateRule>
<listItem enumID="eStop" uiRep="Stop"/>
<listItem enumID="eIT" uiRep="If Touched"/>
</control>
</strategyPanel>
</strategyPanel>
</strategyPanel>
<strategyPanel name="TriggerPanel" class="header-block" indent="true">
<StateRule visible="true">
<edit field="Trigger" operator="EQ" value="true" />
</StateRule>
<!-- Trigger price -->
<strategyPanel name="TriggerPricePanel" orientation="horizontal">
<control id="TriggerPriceLabel_ctrl"
label="Trigger price"
type="Label_t"/>
<control id="TriggerPrice_ctrl"
parameterRef="__trigger_price"
type="SingleSpinner_t">
<StateRule visible="true">
<edit field="TrailStopAllowed" operator="EQ" value="false" />
</StateRule>
</control>
<control id="TriggerPriceType_ctrl"
parameterRef="TriggerPriceType"
type="DropDownList_t">
<listItem enumID="eLtp" uiRep="LTP"/>
<listItem enumID="eBid" uiRep="Bid"/>
<listItem enumID="eAsk" uiRep="Ask"/>
</control>
</strategyPanel>
<!-- Trailing -->
<strategyPanel name="TrailStopPanel" orientation="horizontal">
<control id="TrailStopAllowed"
parameterRef="IsTrlTrg"
label="Trail Offset"
type="CheckBox_t">
</control>
<control id="TrailStop_ctrl"
parameterRef="TriggerTicksAway"
type="SingleSpinner_t">
<StateRule visible="true">
<edit field="TrailStopAllowed" operator="EQ" value="true" />
</StateRule>
</control>
</strategyPanel>
<control type="Spacer_t"> </control>
</strategyPanel>
<!-- Start and End Time -->
<strategyPanel class="header-block">
<control id="TimeAndDate"
label="Time and Date"
initValue="false"
type="CheckBox_t"
tooltip="Set start and end time"> </control>
</strategyPanel>
<strategyPanel name="TimeAndDatePanel" class="header-block" indent="true">
<StateRule visible="true">
<edit field="TimeAndDate" operator="EQ" value="true" />
</StateRule>
<row>
<control id="Start"
type="DropDownList_t"
initValue="eNow"
label="Start">
<listItem enumID="eNow" uiRep="Now"/>
<listItem enumID="eTime" uiRep="Time"/>
</control>
</row>
<strategyPanel name="StartTimeControlPanel" orientation="horizontal">
<StateRule visible="true">
<edit field="Start" operator="EQ" value="eTime" />
</StateRule>
<control type="Spacer_t"> </control>
<control id="StartTime_ctrl"
parameterRef="STime"
type="Clock_t"
initValueMode="1">
</control>
</strategyPanel>
<row>
<control id="End"
type="DropDownList_t"
initValue="eGTC"
label="End">
<listItem enumID="eGTC" uiRep="GTC"/>
<listItem enumID="eTime" uiRep="Time"/>
</control>
</row>
<strategyPanel name="EndTimeControlPanel" orientation="horizontal">
<StateRule visible="true">
<edit field="End" operator="EQ" value="eTime" />
</StateRule>
<control type="Spacer_t"> </control>
<control id="EndTime_ctrl"
parameterRef="ETime"
type="Clock_t"
initValueMode="1">
</control>
</strategyPanel>
<strategyPanel orientation="horizontal" indent="true">
<control id="EndTimeAction_ctrl"
parameterRef="ETimeAct"
label="At End Action"
type="DropDownList_t"
initValue="1">
<StateRule visible="true">
<edit field="End" operator="EQ" value="eTime" />
</StateRule>
<listItem enumID="eCancel" uiRep="Cancel"/>
<listItem enumID="eGoToMarket" uiRep="Go to Market"/>
</control>
</strategyPanel>
</strategyPanel>
</strategyPanel>
</strategyLayout>
<strategyEdit errorMessage="Start Time must precede End Time.">
<edit logicOperator="or">
<edit field="STime" operator="EQ" value="" />
<edit field="ETime" operator="EQ" value="" />
<edit field="STime" operator="LT" field2="ETime" />
</edit>
</strategyEdit>
</strategy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment