-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFaAllocationSamples.py
123 lines (110 loc) · 7.51 KB
/
FaAllocationSamples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
"""
Copyright (C) 2016 Interactive Brokers LLC. All rights reserved. This code is
subject to the terms and conditions of the IB API Non-Commercial License or the
IB API Commercial License, as applicable.
"""
import sys
from ibapi.object_implem import Object
class FaAllocationSamples(Object):
#! [faonegroup]
FaOneGroup = "".join(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
, "<ListOfGroups>"
, "<Group>"
, "<name>Equal_Quantity</name>"
, "<ListOfAccts varName=\"list\">"
#Replace with your own accountIds
, "<String>DU119915</String>"
, "<String>DU119916</String>"
, "</ListOfAccts>"
, "<defaultMethod>EqualQuantity</defaultMethod>"
, "</Group>"
, "</ListOfGroups>"))
#! [faonegroup]
#! [fatwogroups]
FaTwoGroups = "".join(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
,"<ListOfGroups>"
, "<Group>"
, "<name>Equal_Quantity</name>"
, "<ListOfAccts varName=\"list\">"
#Replace with your own accountIds
, "<String>DU119915</String>"
, "<String>DU119916</String>"
, "</ListOfAccts>"
, "<defaultMethod>EqualQuantity</defaultMethod>"
, "</Group>"
, "<Group>"
, "<name>Pct_Change</name>"
, "<ListOfAccts varName=\"list\">"
#Replace with your own accountIds
, "<String>DU119915</String>"
, "<String>DU119916</String>"
, "</ListOfAccts>"
, "<defaultMethod>PctChange</defaultMethod>"
, "</Group>"
, "</ListOfGroups>"))
#! [fatwogroups]
#! [faoneprofile]
FaOneProfile = "".join(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
, "<ListOfAllocationProfiles>"
, "<AllocationProfile>"
, "<name>Percent_60_40</name>"
, "<type>1</type>"
, "<ListOfAllocations varName=\"listOfAllocations\">"
, "<Allocation>"
#Replace with your own accountIds
, "<acct>DU119915</acct>"
, "<amount>60.0</amount>"
, "</Allocation>"
, "<Allocation>"
#Replace with your own accountIds
, "<acct>DU119916</acct>"
, "<amount>40.0</amount>"
, "</Allocation>"
, "</ListOfAllocations>"
, "</AllocationProfile>"
, "</ListOfAllocationProfiles>"))
#! [faoneprofile]
#! [fatwoprofiles]
FaTwoProfiles = "".join(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
, "<ListOfAllocationProfiles>"
, "<AllocationProfile>"
, "<name>Percent_60_40</name>"
, "<type>1</type>"
, "<ListOfAllocations varName=\"listOfAllocations\">"
, "<Allocation>"
#Replace with your own accountIds
, "<acct>DU119915</acct>"
, "<amount>60.0</amount>"
, "</Allocation>"
, "<Allocation>"
#Replace with your own accountIds
, "<acct>DU119916</acct>"
, "<amount>40.0</amount>"
, "</Allocation>"
, "</ListOfAllocations>"
, "</AllocationProfile>"
, "<AllocationProfile>"
, "<name>Ratios_2_1</name>"
, "<type>1</type>"
, "<ListOfAllocations varName=\"listOfAllocations\">"
, "<Allocation>"
#Replace with your own accountIds
, "<acct>DU119915</acct>"
, "<amount>2.0</amount>"
, "</Allocation>"
, "<Allocation>"
#Replace with your own accountIds
, "<acct>DU119916</acct>"
, "<amount>1.0</amount>"
, "</Allocation>"
, "</ListOfAllocations>"
, "</AllocationProfile>"
, "</ListOfAllocationProfiles>"))
#! [fatwoprofiles]
def Test():
print(FaAllocationSamples.FaOneGroup)
print(FaAllocationSamples.FaTwoGroups)
print(FaAllocationSamples.FaOneProfile)
print(FaAllocationSamples.FaTwoProfiles)
if "__main__" == __name__:
Test()