wherever-positions 0.4.7 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.7
1
+ 0.5.0
@@ -33,10 +33,10 @@ module MethodLogging
33
33
  when "String"
34
34
  %Q{"#{arg}"}
35
35
  when "Fixnum", "Integer", "Float"
36
- arg.to_s
37
- when "Hash"
38
- string = arg.map do |k, v|
39
- "#{strify(k)} => #{strify(v)}"
36
+ '%.5f' % arg.to_s
37
+ when "Hash", "BSON::OrderedHash", "HashWithIndifferentAccess"
38
+ string = arg.keys.sort.map do |k|
39
+ "#{strify(k)} => #{strify(arg[k])}"
40
40
  end.join(', ')
41
41
  "{#{string}}"
42
42
  when "Array"
@@ -12,6 +12,10 @@ module DbStore
12
12
 
13
13
  base.field :values, :type => Hash, :default => Hash.new(0)
14
14
  end
15
+
16
+ def sorter
17
+ self.trade_id * 100 + self.version
18
+ end
15
19
 
16
20
  def diff(record)
17
21
  res = {}
@@ -1,7 +1,7 @@
1
1
  module DbStore
2
2
  module RecordMatcher
3
3
  def ==(record)
4
- self.clean_attributes == record.clean_attributes
4
+ MethodLogging.strify(self.clean_attributes) == MethodLogging.strify(record.clean_attributes)
5
5
  end
6
6
 
7
7
  protected
@@ -21,14 +21,14 @@ class Wherever
21
21
  get_key_store("unique")
22
22
  end
23
23
 
24
- def identifier_key
25
- key = version_key
24
+ def identifier_key(options)
25
+ key = version_key(options)
26
26
  key.delete("version")
27
27
  key
28
28
  end
29
29
 
30
- def version_key
31
- {}.merge(@options["unique"]).merge(@options["keys"])
30
+ def version_key(options)
31
+ {}.merge(options["unique"]).merge(options["keys"])
32
32
  end
33
33
  end
34
34
  end
@@ -1,42 +1,41 @@
1
1
  class Wherever
2
2
  module Adder
3
3
  def add(values, options)
4
- @options = options
5
- if record = find
6
- update(record.diff(values), record)
4
+ if record = find(identifier_key(options))
5
+ update(record.diff(values), record, options)
7
6
  else
8
- create(values)
7
+ create(values, options)
9
8
  end
10
9
  end
11
10
 
12
11
  protected
13
- def find
14
- identifier_set.datasets.where(identifier_key).first
12
+ def find(key)
13
+ identifier_set.datasets.where(key).first
15
14
  end
16
15
 
17
- def create(values)
18
- for_unique(values)
19
- id_record = create_for_identifier(values)
16
+ def create(values, options)
17
+ for_unique(values, options)
18
+ id_record = create_for_identifier(values, options)
20
19
  config.key_groups.each do |group|
21
20
  for_group(group, values, id_record)
22
21
  end
23
22
  end
24
23
 
25
- def update(diff, record)
26
- for_unique(diff)
27
- id_record = update_for_identifier(diff, record)
24
+ def update(diff, record, options)
25
+ for_unique(diff, options)
26
+ id_record = update_for_identifier(diff, record, options["unique"]["version"])
28
27
  config.key_groups.each do |group|
29
28
  for_group(group, diff, id_record)
30
29
  end
31
30
  end
32
31
 
33
- def create_for_identifier(values)
34
- record = identifier_set.datasets.create(version_key)
32
+ def create_for_identifier(values, options)
33
+ record = identifier_set.datasets.create(version_key(options))
35
34
  update_record(record, values, record)
36
35
  end
37
36
 
38
- def update_for_identifier(diff, record)
39
- record["version"] = @options["unique"]["version"]
37
+ def update_for_identifier(diff, record, version)
38
+ record["version"] = version
40
39
  update_record(record, diff, record)
41
40
  end
42
41
 
@@ -46,25 +45,25 @@ class Wherever
46
45
  record
47
46
  end
48
47
 
49
- def for_unique(values)
50
- unique_set.datasets.create(version_key.merge("values" => values.clone))
48
+ def for_unique(values, options)
49
+ unique_set.datasets.create(version_key(options).merge("values" => values.clone))
51
50
  end
52
51
 
53
- def for_group(group_keys, values, id_record)
52
+ def for_group(group_keys, values, id_record, update_required=true)
54
53
  key = {}
55
54
  group_keys.each do |key_values|
56
- key.merge!(key_values.to_id => @options["keys"][key_values.to_id])
55
+ key.merge!(key_values.to_id => id_record[key_values.to_id])
57
56
  end
58
57
  store = get_key_store(*group_keys)
59
58
  record = store.datasets.find_or_create_by(key)
60
59
 
61
60
  update_record(record, values, id_record, group_keys)
62
- update_identifier(store, @options["unique"])
61
+ update_identifier(store, id_record) if update_required
63
62
  end
64
63
 
65
- def update_identifier(store, unique)
66
- record = store.identifiers.find_or_create_by(config._id => unique[config._id])
67
- record["version"] = unique["version"]
64
+ def update_identifier(store, id_record)
65
+ record = store.identifiers.find_or_create_by(config._id => id_record[config._id])
66
+ record["version"] = id_record.version
68
67
  record.save
69
68
  end
70
69
  end
@@ -51,7 +51,7 @@ class Wherever
51
51
  record.save!
52
52
  config.key_groups.each do |group|
53
53
  if keys & group != keys
54
- for_group(group, record.values, record)
54
+ for_group(group, record.values, record, false)
55
55
  end
56
56
  end
57
57
  end
@@ -0,0 +1,258 @@
1
+ wherever.add({"position" => 195000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8288, "version" => 6}})
2
+ wherever.add({"position" => 9720}, {"keys" => {"technical_instrument_id" => 1046, "fund_id" => 8}, "unique" => {"trade_id" => 8289, "version" => 7}})
3
+ wherever.add({"position" => 12943}, {"keys" => {"technical_instrument_id" => 1446, "fund_id" => 8}, "unique" => {"trade_id" => 8290, "version" => 3}})
4
+ wherever.add({"position" => 43}, {"keys" => {"technical_instrument_id" => 1411, "fund_id" => 9}, "unique" => {"trade_id" => 8291, "version" => 9}})
5
+ wherever.add({"position" => 43}, {"keys" => {"technical_instrument_id" => 1411, "fund_id" => 9}, "unique" => {"trade_id" => 8292, "version" => 10}})
6
+ wherever.add({"position" => 10111}, {"keys" => {"technical_instrument_id" => 1545, "fund_id" => 3}, "unique" => {"trade_id" => 8293, "version" => 3}})
7
+ wherever.add({"position" => 17042}, {"keys" => {"technical_instrument_id" => 1580, "fund_id" => 3}, "unique" => {"trade_id" => 8294, "version" => 3}})
8
+ wherever.add({"position" => 17042}, {"keys" => {"technical_instrument_id" => 1580, "fund_id" => 3}, "unique" => {"trade_id" => 8295, "version" => 4}})
9
+ wherever.add({"position" => 10111}, {"keys" => {"technical_instrument_id" => 1545, "fund_id" => 3}, "unique" => {"trade_id" => 8296, "version" => 4}})
10
+ wherever.add({"position" => 12943}, {"keys" => {"technical_instrument_id" => 1446, "fund_id" => 8}, "unique" => {"trade_id" => 8297, "version" => 4}})
11
+ wherever.add({"position" => 1200000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8298, "version" => 1}})
12
+ wherever.add({"position" => 7170}, {"keys" => {"technical_instrument_id" => 1580, "fund_id" => 3}, "unique" => {"trade_id" => 8299, "version" => 3}})
13
+ wherever.add({"position" => 7170}, {"keys" => {"technical_instrument_id" => 1580, "fund_id" => 3}, "unique" => {"trade_id" => 8300, "version" => 4}})
14
+ wherever.add({"position" => 1000}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8301, "version" => 6}})
15
+ wherever.add({"position" => 1000}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8302, "version" => 7}})
16
+ wherever.add({"position" => 12310}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8303, "version" => 5}})
17
+ wherever.add({"position" => 12310}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8304, "version" => 6}})
18
+ wherever.add({"position" => 34765}, {"keys" => {"technical_instrument_id" => 1446, "fund_id" => 3}, "unique" => {"trade_id" => 8305, "version" => 3}})
19
+ wherever.add({"position" => 34765}, {"keys" => {"technical_instrument_id" => 1446, "fund_id" => 3}, "unique" => {"trade_id" => 8306, "version" => 4}})
20
+ wherever.add({"position" => 80000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 3}, "unique" => {"trade_id" => 8307, "version" => 6}})
21
+ wherever.add({"position" => 20000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8308, "version" => 9}})
22
+ wherever.add({"position" => 8280}, {"keys" => {"technical_instrument_id" => 1046, "fund_id" => 3}, "unique" => {"trade_id" => 8309, "version" => 6}})
23
+ wherever.add({"position" => 3563}, {"keys" => {"technical_instrument_id" => 1579, "fund_id" => 3}, "unique" => {"trade_id" => 8310, "version" => 6}})
24
+ wherever.add({"position" => 2151}, {"keys" => {"technical_instrument_id" => 1545, "fund_id" => 3}, "unique" => {"trade_id" => 8311, "version" => 3}})
25
+ wherever.add({"position" => 2151}, {"keys" => {"technical_instrument_id" => 1545, "fund_id" => 3}, "unique" => {"trade_id" => 8312, "version" => 4}})
26
+ wherever.add({"position" => 5119}, {"keys" => {"technical_instrument_id" => 1545, "fund_id" => 7}, "unique" => {"trade_id" => 8313, "version" => 3}})
27
+ wherever.add({"position" => 5119}, {"keys" => {"technical_instrument_id" => 1545, "fund_id" => 7}, "unique" => {"trade_id" => 8314, "version" => 4}})
28
+ wherever.add({"position" => 8628}, {"keys" => {"technical_instrument_id" => 1580, "fund_id" => 7}, "unique" => {"trade_id" => 8315, "version" => 3}})
29
+ wherever.add({"position" => 8628}, {"keys" => {"technical_instrument_id" => 1580, "fund_id" => 7}, "unique" => {"trade_id" => 8316, "version" => 4}})
30
+ wherever.add({"position" => 3630}, {"keys" => {"technical_instrument_id" => 1580, "fund_id" => 7}, "unique" => {"trade_id" => 8317, "version" => 3}})
31
+ wherever.add({"position" => 3630}, {"keys" => {"technical_instrument_id" => 1580, "fund_id" => 7}, "unique" => {"trade_id" => 8318, "version" => 4}})
32
+ wherever.add({"position" => 1000}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 7}, "unique" => {"trade_id" => 8319, "version" => 6}})
33
+ wherever.add({"position" => 1000}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 7}, "unique" => {"trade_id" => 8320, "version" => 7}})
34
+ wherever.add({"position" => 37361}, {"keys" => {"technical_instrument_id" => 1446, "fund_id" => 7}, "unique" => {"trade_id" => 8321, "version" => 3}})
35
+ wherever.add({"position" => 37361}, {"keys" => {"technical_instrument_id" => 1446, "fund_id" => 7}, "unique" => {"trade_id" => 8322, "version" => 4}})
36
+ wherever.add({"position" => 25000}, {"keys" => {"technical_instrument_id" => 1898, "fund_id" => 6}, "unique" => {"trade_id" => 8323, "version" => 6}})
37
+ wherever.add({"position" => 50661}, {"keys" => {"technical_instrument_id" => 1898, "fund_id" => 6}, "unique" => {"trade_id" => 8324, "version" => 6}})
38
+ wherever.add({"position" => 10000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8325, "version" => 1}})
39
+ wherever.add({"position" => 5672}, {"keys" => {"technical_instrument_id" => 1894, "fund_id" => 3}, "unique" => {"trade_id" => 8326, "version" => 6}})
40
+ wherever.add({"position" => 1255900}, {"keys" => {"technical_instrument_id" => 1755, "fund_id" => 9}, "unique" => {"trade_id" => 8327, "version" => 6}})
41
+ wherever.add({"position" => 1255900}, {"keys" => {"technical_instrument_id" => 1755, "fund_id" => 9}, "unique" => {"trade_id" => 8328, "version" => 7}})
42
+ wherever.add({"position" => 70000000}, {"keys" => {"technical_instrument_id" => 1762, "fund_id" => 7}, "unique" => {"trade_id" => 8329, "version" => 5}})
43
+ wherever.add({"position" => 1463636}, {"keys" => {"technical_instrument_id" => 1677, "fund_id" => 6}, "unique" => {"trade_id" => 8330, "version" => 4}})
44
+ wherever.add({"position" => 38}, {"keys" => {"technical_instrument_id" => 1411, "fund_id" => 8}, "unique" => {"trade_id" => 8331, "version" => 4}})
45
+ wherever.add({"position" => 62}, {"keys" => {"technical_instrument_id" => 1411, "fund_id" => 3}, "unique" => {"trade_id" => 8332, "version" => 4}})
46
+ wherever.add({"position" => 1678}, {"keys" => {"technical_instrument_id" => 1982, "fund_id" => 6}, "unique" => {"trade_id" => 8333, "version" => 4}})
47
+ wherever.add({"position" => 50000}, {"keys" => {"technical_instrument_id" => 1046, "fund_id" => 3}, "unique" => {"trade_id" => 8334, "version" => 3}})
48
+ wherever.add({"position" => 5500}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8335, "version" => 6}})
49
+ wherever.add({"position" => 5500}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8336, "version" => 7}})
50
+ wherever.add({"position" => 11026397328}, {"keys" => {"technical_instrument_id" => 1838, "fund_id" => 5}, "unique" => {"trade_id" => 8337, "version" => 7}})
51
+ wherever.add({"position" => 69015}, {"keys" => {"technical_instrument_id" => 1446, "fund_id" => 5}, "unique" => {"trade_id" => 8338, "version" => 3}})
52
+ wherever.add({"position" => 69015}, {"keys" => {"technical_instrument_id" => 1446, "fund_id" => 5}, "unique" => {"trade_id" => 8339, "version" => 4}})
53
+ wherever.add({"position" => 30000}, {"keys" => {"technical_instrument_id" => 1928, "fund_id" => 5}, "unique" => {"trade_id" => 8340, "version" => 6}})
54
+ wherever.add({"position" => 34900}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8341, "version" => 5}})
55
+ wherever.add({"position" => 34900}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8342, "version" => 6}})
56
+ wherever.add({"position" => 785000}, {"keys" => {"technical_instrument_id" => 1928, "fund_id" => 5}, "unique" => {"trade_id" => 8343, "version" => 5}})
57
+ wherever.add({"position" => 228000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 5}, "unique" => {"trade_id" => 8344, "version" => 3}})
58
+ wherever.add({"position" => 3740016471}, {"keys" => {"technical_instrument_id" => 1838, "fund_id" => 5}, "unique" => {"trade_id" => 8345, "version" => 4}})
59
+ wherever.add({"position" => 1000}, {"keys" => {"technical_instrument_id" => 1982, "fund_id" => 5}, "unique" => {"trade_id" => 8346, "version" => 7}})
60
+ wherever.add({"position" => 2000}, {"keys" => {"technical_instrument_id" => 1225, "fund_id" => 8}, "unique" => {"trade_id" => 8347, "version" => 1}})
61
+ wherever.add({"position" => 10000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8348, "version" => 2}})
62
+ wherever.add({"position" => 17}, {"keys" => {"technical_instrument_id" => 1118, "fund_id" => 6}, "unique" => {"trade_id" => 8349, "version" => 1}})
63
+ wherever.add({"position" => 17}, {"keys" => {"technical_instrument_id" => 1118, "fund_id" => 8}, "unique" => {"trade_id" => 8350, "version" => 1}})
64
+ wherever.add({"position" => 5862}, {"keys" => {"technical_instrument_id" => 1186, "fund_id" => 8}, "unique" => {"trade_id" => 8351, "version" => 1}})
65
+ wherever.add({"position" => 5862}, {"keys" => {"technical_instrument_id" => 1186, "fund_id" => 6}, "unique" => {"trade_id" => 8352, "version" => 1}})
66
+ wherever.add({"position" => 950000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8353, "version" => 1}})
67
+ wherever.add({"position" => 13900}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8354, "version" => 6}})
68
+ wherever.add({"position" => 4678}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8355, "version" => 7}})
69
+ wherever.add({"position" => 1000}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 7}, "unique" => {"trade_id" => 8356, "version" => 6}})
70
+ wherever.add({"position" => 1463636}, {"keys" => {"technical_instrument_id" => 1677, "fund_id" => 5}, "unique" => {"trade_id" => 8357, "version" => 3}})
71
+ wherever.add({"position" => 150000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8358, "version" => 5}})
72
+ wherever.add({"position" => 850000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 7}, "unique" => {"trade_id" => 8359, "version" => 5}})
73
+ wherever.add({"position" => 1200000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8360, "version" => 2}})
74
+ wherever.add({"position" => 2000}, {"keys" => {"technical_instrument_id" => 1225, "fund_id" => 8}, "unique" => {"trade_id" => 8361, "version" => 2}})
75
+ wherever.add({"position" => 150000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8362, "version" => 6}})
76
+ wherever.add({"position" => 850000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 7}, "unique" => {"trade_id" => 8363, "version" => 6}})
77
+ wherever.add({"position" => 2000}, {"keys" => {"technical_instrument_id" => 1225, "fund_id" => 8}, "unique" => {"trade_id" => 8364, "version" => 3}})
78
+ wherever.add({"position" => 850000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 7}, "unique" => {"trade_id" => 8365, "version" => 7}})
79
+ wherever.add({"position" => 150000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8366, "version" => 7}})
80
+ wherever.add({"position" => 17}, {"keys" => {"technical_instrument_id" => 1118, "fund_id" => 6}, "unique" => {"trade_id" => 8367, "version" => 2}})
81
+ wherever.add({"position" => 17}, {"keys" => {"technical_instrument_id" => 1118, "fund_id" => 8}, "unique" => {"trade_id" => 8368, "version" => 2}})
82
+ wherever.add({"position" => 150000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8369, "version" => 8}})
83
+ wherever.add({"position" => 850000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 7}, "unique" => {"trade_id" => 8370, "version" => 8}})
84
+ wherever.add({"position" => 1200000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8371, "version" => 3}})
85
+ wherever.add({"position" => 2500}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 7}, "unique" => {"trade_id" => 8372, "version" => 1}})
86
+ wherever.add({"position" => 400}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 3}, "unique" => {"trade_id" => 8373, "version" => 1}})
87
+ wherever.add({"position" => 21300}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 2}, "unique" => {"trade_id" => 8374, "version" => 1}})
88
+ wherever.add({"position" => 800}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 6}, "unique" => {"trade_id" => 8375, "version" => 1}})
89
+ wherever.add({"position" => 5935}, {"keys" => {"technical_instrument_id" => 1101, "fund_id" => 6}, "unique" => {"trade_id" => 8376, "version" => 5}})
90
+ wherever.add({"position" => 335000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8377, "version" => 1}})
91
+ wherever.add({"position" => 1200000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8378, "version" => 4}})
92
+ wherever.add({"position" => 1200000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8379, "version" => 5}})
93
+ wherever.add({"position" => 400}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 3}, "unique" => {"trade_id" => 8380, "version" => 2}})
94
+ wherever.add({"position" => 800}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 6}, "unique" => {"trade_id" => 8381, "version" => 2}})
95
+ wherever.add({"position" => 21300}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 2}, "unique" => {"trade_id" => 8382, "version" => 2}})
96
+ wherever.add({"position" => 950000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8383, "version" => 2}})
97
+ wherever.add({"position" => 17}, {"keys" => {"technical_instrument_id" => 1118, "fund_id" => 6}, "unique" => {"trade_id" => 8384, "version" => 3}})
98
+ wherever.add({"position" => 17}, {"keys" => {"technical_instrument_id" => 1118, "fund_id" => 8}, "unique" => {"trade_id" => 8385, "version" => 3}})
99
+ wherever.add({"position" => 17}, {"keys" => {"technical_instrument_id" => 1118, "fund_id" => 8}, "unique" => {"trade_id" => 8386, "version" => 4}})
100
+ wherever.add({"position" => 10000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8387, "version" => 3}})
101
+ wherever.add({"position" => 950000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8388, "version" => 3}})
102
+ wherever.add({"position" => 2500}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 7}, "unique" => {"trade_id" => 8389, "version" => 2}})
103
+ wherever.add({"position" => 500000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 5}, "unique" => {"trade_id" => 8390, "version" => 1}})
104
+ wherever.add({"position" => 5862}, {"keys" => {"technical_instrument_id" => 1186, "fund_id" => 6}, "unique" => {"trade_id" => 8391, "version" => 2}})
105
+ wherever.add({"position" => 5862}, {"keys" => {"technical_instrument_id" => 1186, "fund_id" => 8}, "unique" => {"trade_id" => 8392, "version" => 2}})
106
+ wherever.add({"position" => 785000}, {"keys" => {"technical_instrument_id" => 1928, "fund_id" => 5}, "unique" => {"trade_id" => 8393, "version" => 6}})
107
+ wherever.add({"position" => 335000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8394, "version" => 2}})
108
+ wherever.add({"position" => 450000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 5}, "unique" => {"trade_id" => 8395, "version" => 6}})
109
+ wherever.add({"position" => 390000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 5}, "unique" => {"trade_id" => 8396, "version" => 6}})
110
+ wherever.add({"position" => 3740016471}, {"keys" => {"technical_instrument_id" => 1838, "fund_id" => 5}, "unique" => {"trade_id" => 8397, "version" => 5}})
111
+ wherever.add({"position" => 785000}, {"keys" => {"technical_instrument_id" => 1928, "fund_id" => 5}, "unique" => {"trade_id" => 8398, "version" => 7}})
112
+ wherever.add({"position" => 228000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 5}, "unique" => {"trade_id" => 8399, "version" => 4}})
113
+ wherever.add({"position" => 48416}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 5}, "unique" => {"trade_id" => 8400, "version" => 12}})
114
+ wherever.add({"position" => 5500}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8401, "version" => 8}})
115
+ wherever.add({"position" => 5500}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8402, "version" => 9}})
116
+ wherever.add({"position" => 225000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8403, "version" => 6}})
117
+ wherever.add({"position" => 225000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8404, "version" => 7}})
118
+ wherever.add({"position" => 114000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8405, "version" => 6}})
119
+ wherever.add({"position" => 166}, {"keys" => {"technical_instrument_id" => 1266, "fund_id" => 8}, "unique" => {"trade_id" => 8406, "version" => 5}})
120
+ wherever.add({"position" => 1500}, {"keys" => {"technical_instrument_id" => 1122, "fund_id" => 8}, "unique" => {"trade_id" => 8407, "version" => 7}})
121
+ wherever.add({"position" => 2331051000}, {"keys" => {"technical_instrument_id" => 1831, "fund_id" => 4}, "unique" => {"trade_id" => 8408, "version" => 4}})
122
+ wherever.add({"position" => 500}, {"keys" => {"technical_instrument_id" => 1982, "fund_id" => 3}, "unique" => {"trade_id" => 8409, "version" => 7}})
123
+ wherever.add({"position" => 400000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8410, "version" => 6}})
124
+ wherever.add({"position" => 1991647}, {"keys" => {"technical_instrument_id" => 1310, "fund_id" => 3}, "unique" => {"trade_id" => 8411, "version" => 5}})
125
+ wherever.add({"position" => 8358}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 3}, "unique" => {"trade_id" => 8412, "version" => 16}})
126
+ wherever.add({"position" => 2331051000}, {"keys" => {"technical_instrument_id" => 1831, "fund_id" => 3}, "unique" => {"trade_id" => 8413, "version" => 4}})
127
+ wherever.add({"position" => 20643}, {"keys" => {"technical_instrument_id" => 1579, "fund_id" => 7}, "unique" => {"trade_id" => 8414, "version" => 6}})
128
+ wherever.add({"position" => 72226}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 7}, "unique" => {"trade_id" => 8415, "version" => 15}})
129
+ wherever.add({"position" => 1008353}, {"keys" => {"technical_instrument_id" => 1310, "fund_id" => 7}, "unique" => {"trade_id" => 8416, "version" => 5}})
130
+ wherever.add({"position" => 174}, {"keys" => {"technical_instrument_id" => 1266, "fund_id" => 11}, "unique" => {"trade_id" => 8417, "version" => 5}})
131
+ wherever.add({"position" => 660}, {"keys" => {"technical_instrument_id" => 1266, "fund_id" => 6}, "unique" => {"trade_id" => 8418, "version" => 6}})
132
+ wherever.add({"position" => 1500000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 5}, "unique" => {"trade_id" => 8419, "version" => 5}})
133
+ wherever.add({"position" => 9000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8420, "version" => 1}})
134
+ wherever.add({"position" => 199817763}, {"keys" => {"technical_instrument_id" => 1762, "fund_id" => 7}, "unique" => {"trade_id" => 8421, "version" => 1}})
135
+ wherever.add({"position" => 1463636}, {"keys" => {"technical_instrument_id" => 1677, "fund_id" => 6}, "unique" => {"trade_id" => 8422, "version" => 5}})
136
+ wherever.add({"position" => 10000000}, {"keys" => {"technical_instrument_id" => 1935, "fund_id" => 2}, "unique" => {"trade_id" => 8423, "version" => 1}})
137
+ wherever.add({"position" => 25000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8424, "version" => 4}})
138
+ wherever.add({"position" => 250000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 7}, "unique" => {"trade_id" => 8425, "version" => 6}})
139
+ wherever.add({"position" => 2000}, {"keys" => {"technical_instrument_id" => 1225, "fund_id" => 8}, "unique" => {"trade_id" => 8426, "version" => 4}})
140
+ wherever.add({"position" => 2000}, {"keys" => {"technical_instrument_id" => 1225, "fund_id" => 8}, "unique" => {"trade_id" => 8427, "version" => 5}})
141
+ wherever.add({"position" => 5000}, {"keys" => {"technical_instrument_id" => 1122, "fund_id" => 11}, "unique" => {"trade_id" => 8428, "version" => 1}})
142
+ wherever.add({"position" => 5000}, {"keys" => {"technical_instrument_id" => 1122, "fund_id" => 11}, "unique" => {"trade_id" => 8429, "version" => 2}})
143
+ wherever.add({"position" => 10000000}, {"keys" => {"technical_instrument_id" => 1935, "fund_id" => 2}, "unique" => {"trade_id" => 8430, "version" => 2}})
144
+ wherever.add({"position" => 9000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8431, "version" => 2}})
145
+ wherever.add({"position" => 199817763}, {"keys" => {"technical_instrument_id" => 1762, "fund_id" => 7}, "unique" => {"trade_id" => 8432, "version" => 2}})
146
+ wherever.add({"position" => 500000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 5}, "unique" => {"trade_id" => 8433, "version" => 2}})
147
+ wherever.add({"position" => 335000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8434, "version" => 3}})
148
+ wherever.add({"position" => 335000}, {"keys" => {"technical_instrument_id" => 1709, "fund_id" => 5}, "unique" => {"trade_id" => 8435, "version" => 4}})
149
+ wherever.add({"position" => 500000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 5}, "unique" => {"trade_id" => 8436, "version" => 3}})
150
+ wherever.add({"position" => 7260400}, {"keys" => {"technical_instrument_id" => 1935, "fund_id" => 10}, "unique" => {"trade_id" => 8437, "version" => 1}})
151
+ wherever.add({"position" => 18522}, {"keys" => {"technical_instrument_id" => 1632, "fund_id" => 10}, "unique" => {"trade_id" => 8438, "version" => 1}})
152
+ wherever.add({"position" => 10000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8439, "version" => 4}})
153
+ wherever.add({"position" => 9000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8440, "version" => 3}})
154
+ wherever.add({"position" => 10000000}, {"keys" => {"technical_instrument_id" => 1935, "fund_id" => 2}, "unique" => {"trade_id" => 8441, "version" => 3}})
155
+ wherever.add({"position" => 5000}, {"keys" => {"technical_instrument_id" => 1122, "fund_id" => 11}, "unique" => {"trade_id" => 8442, "version" => 3}})
156
+ wherever.add({"position" => 250000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 7}, "unique" => {"trade_id" => 8443, "version" => 7}})
157
+ wherever.add({"position" => 25000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8444, "version" => 5}})
158
+ wherever.set_price("2009-10-30", {1273 => 0.0, 1556 => 0.3, 990 => 12.0695036937, 1839 => 0.0098094026, 1698 => 46.1743049228, 1415 => 0.1268806, 1132 => 0.14, 0 => 1.1339636281, 1557 => 189.0, 1274 => 95.0, 991 => 265.0, 1840 => 0.007134111, 1416 => 1.2928805378, 1699 => 7.6341517472, 1133 => 53.5, 1982 => 845.9485006362, 1558 => 65.0, 1275 => 52.5, 992 => 3.757053336, 1841 => 0.001852125, 1700 => 1.0, 1417 => 0.476148975, 1134 => 15.0, 1983 => 0.03, 1559 => 79.5, 1276 => 0.0875, 993 => 14.7400547983, 1842 => 0.0022294097, 1984 => 250.0, 1135 => 0.0597187677, 1701 => 0.0071958485, 1418 => 0.2975, 1560 => 145.0, 1277 => 0.15, 1843 => 0.0053, 1136 => 1.8623636319, 1419 => 1.5391434974, 1702 => 0.0072061381, 1985 => 0.3148955436, 1278 => 0.0084, 1561 => 65.0, 995 => 19.143315, 1844 => 0.0044, 1420 => 0.0, 1137 => 1.1655962608, 1986 => 31.4895543582, 1703 => 0.0168063192, 1279 => 0.0024, 1562 => 27.5, 996 => 1.7887582874, 1845 => 0.0154343748, 1987 => 0.0, 1421 => 0.0, 1138 => 35.5, 1704 => 0.0107011665, 1280 => 0.0105, 1563 => 14.25, 1846 => 0.0247978954, 1422 => 0.3102913291, 1705 => 0.4250151791, 1139 => 6.95, 1281 => 0.0084, 1564 => 4.0, 1847 => 0.0123303505, 1140 => 3.65, 1423 => 0.0547935085, 1706 => 0.0351217772, 1565 => 58.4455183721, 1282 => 6.5, 999 => 0.14, 1848 => 0.068700117, 1424 => 0.64, 1141 => 0.605, 1707 => 3.56, 1566 => 58.4, 1283 => 48.0, 1849 => 0.0779092939, 1425 => 5.0, 1142 => 0.3375, 1708 => 0.0009980896, 1567 => 19.9031380614, 1284 => 27.5, 1001 => 105.0, 1850 => 0.14, 1426 => 4.225, 1709 => 0.4590183052, 1002 => 0.0, 1568 => 16.0, 1851 => 0.135, 1427 => 14.5, 1144 => 1.025, 1710 => 0.0049330842, 1852 => 19.707193341, 1569 => 8.4528925733, 1286 => 3.0, 1003 => 160.0, 1145 => 2.1178614525, 1428 => 13.5, 1711 => 0.0050491567, 1570 => 16.9057851466, 1287 => 155.0, 1004 => 340.0, 1853 => 0.2482876419, 1429 => 9.132112, 1146 => 0.7, 1712 => 0.02255, 1005 => 0.0615657399, 1571 => 105.0, 1288 => 1.15, 1854 => 0.0290852218, 1430 => 157.0, 1147 => 0.4225, 1713 => 0.3485939285, 1289 => 70.0, 1006 => 57.0, 1855 => 0.0272502461, 1572 => 21.0, 1431 => 1.375, 1148 => 1800.0, 1714 => 0.0105, 1573 => 2100.0, 1290 => 52.5, 1007 => 2732.2959146925, 1856 => 0.3738377058, 1432 => 2.8, 1149 => 35.0, 1715 => 0.0101, 1574 => 1700.0, 1857 => 0.0646440269, 1291 => 58.0, 1008 => 700.0, 1150 => 0.0333333333, 1433 => 0.5861058438, 1716 => 0.4001773093, 1009 => 0.0, 1292 => 43.75, 1858 => 0.1285683417, 1575 => 0.45, 1717 => 0.1185662963, 1434 => 24.75, 1151 => 3600.0, 1293 => 60.5, 1010 => 10.25, 1859 => 0.124092373, 1576 => 0.1475, 1152 => 0.0, 1435 => 24.0, 1718 => 0.0044588194, 1294 => 30.5, 1011 => 92.5, 1860 => 0.365, 1577 => 2.55, 1153 => 0.4186470313, 1436 => 13.767369, 1719 => 0.0022808576, 1295 => 2.735, 1012 => 35.0, 1861 => 0.0116786769, 1578 => 0.095, 1154 => 3.1860270397, 1720 => 0.2643941071, 1296 => 1.5, 1013 => 660.0, 1862 => 0.0137, 1579 => 7.626982031, 1438 => 24.38, 1155 => 223.0, 1721 => 0.0658533323, 1297 => 0.0, 1014 => 10000.0, 1863 => 0.5850314004, 1580 => 7.65, 1439 => 2.4502786, 1156 => 380.0, 1722 => 0.0615, 1581 => 0.0, 1298 => 0.0009021985, 1015 => 4160.7644474322, 1864 => 0.5590673522, 1440 => 3.479245, 1157 => 127.5, 1723 => 0.0011, 1865 => 0.9665821164, 1299 => 0.0009021985, 1016 => 23.5, 1582 => 4.8, 1724 => 0.0011, 1158 => 625.0, 1441 => 259.0, 1866 => 51.5305242938, 1017 => 1.046353, 1583 => 1.25, 1442 => 0.0, 1159 => 195.0, 1725 => 0.0100494929, 1301 => 29.4014549471, 1018 => 1.8255, 1867 => 12.238443, 1584 => 0.4655, 1443 => 0.0, 1160 => 0.0005033321, 1726 => 0.0053505832, 1868 => 0.4186470313, 1302 => 78.0, 1019 => 0.6505, 1585 => 47.5, 1161 => 0.0002, 1727 => 0.045, 1444 => 0.107107, 1869 => 0.4007929667, 1303 => 265.0, 1020 => 361.0, 1586 => 35.5, 1162 => 15.8, 1728 => 0.04345, 1445 => 0.3528647042, 1304 => 111.5, 1021 => 200.0, 1587 => 145.9563457839, 1163 => 7.375, 1729 => 1.4340249077, 1446 => 1.326479, 1022 => 0.0, 1305 => 778.3133315269, 1871 => 2.3, 1588 => 23.65, 1730 => 0.4623587066, 1164 => 11.5, 1306 => 12.4, 1023 => 0.031, 1589 => 33.5699595303, 1165 => 5.55, 1731 => 0.19, 1448 => 12.330505, 1307 => 12.1005, 1024 => 0.0205, 1873 => 2.0, 1590 => 68.0, 1166 => 35.0, 1732 => 0.4866972839, 1449 => 80.0, 1308 => 0.0029139907, 1025 => 0.9625, 1874 => 31.9, 1591 => 65.0, 1167 => 44.9429901249, 1733 => 4.2832104871, 1450 => 32.5, 1875 => 5.7, 1309 => 0.475018607, 1026 => 14.995, 1592 => 22.5, 1168 => 2100.0, 1734 => 0.525, 1451 => 1245.0, 1027 => 0.185, 1593 => 20.25, 1310 => 0.3361949807, 1169 => 1500.0, 1735 => 0.3675, 1028 => 0.05, 1877 => 7.49, 1594 => 1.4212275, 1311 => 14.9764883025, 1170 => 170.0, 1736 => 0.05025, 1453 => 8.25, 1029 => 61.15, 1878 => 2.7312285, 1595 => 7.0661173852, 1312 => 410.0, 1171 => 657.5, 1737 => 0.04525, 1454 => 8.25, 1030 => 61.15, 1879 => 51.0, 1596 => 6.9263085026, 1313 => 150.5, 1738 => 0.0885, 1455 => 18.04341, 1031 => 3.875, 1597 => 0.6, 1314 => 1.575, 1173 => 210.0, 1739 => 0.0058650624, 1456 => 75.0, 1032 => 1.05, 1881 => 3.95, 1598 => 0.625, 1315 => 1.65, 1457 => 103.096201021, 1174 => 143.0, 1740 => 0.8668630834, 1033 => 26.25, 1882 => 0.708554, 1599 => 35.0, 1316 => 95.0, 1175 => 0.0, 1741 => 0.7596970747, 1458 => 10.0, 1034 => 13.0, 1883 => 1.7, 1600 => 28.5, 1317 => 2.912638009, 1459 => 0.2136331174, 1176 => 155.51505898, 1742 => 0.0531285478, 1884 => 32.4269353848, 1601 => 0.035, 1318 => 690.0132735623, 1460 => 0.5233087891, 1743 => 0.5171522151, 1177 => 37.486, 1885 => 1.65, 1602 => 0.0475, 1319 => 680.0, 1178 => 0.0926748457, 1744 => 0.0355, 1461 => 530.0, 1886 => 0.0677223139, 1037 => 3.75, 1603 => 2.75, 1320 => 346.0, 1745 => 0.0275, 1462 => 260.0, 1179 => 1.825, 1038 => 0.01, 1887 => 0.3625877616, 1604 => 1.125, 1321 => 19.0, 1746 => 0.155, 1463 => 1423.3923383764, 1180 => 2.7, 1039 => 26.6805461711, 1888 => 0.1371944423, 1605 => 2.05, 1322 => 4.75, 1747 => 0.012, 1181 => 56.5, 1040 => 25.7589425052, 1889 => 0.37054575, 1606 => 0.475, 1323 => 22.61, 1748 => 0.0069283193, 1465 => 0.255, 1182 => 10.0, 1607 => 80.0, 1324 => 6.7977583977, 1749 => 0.0072713054, 1466 => 2.1, 1183 => 0.02015, 1042 => 1.75, 1891 => 0.88, 1608 => 240.0, 1325 => 0.2265919466, 1750 => 0.0226713816, 1184 => 0.02, 1043 => 1.1, 1892 => 8.5029685447, 1609 => 250.0, 1326 => 16.5859483845, 1751 => 0.0427017702, 1468 => 9.5, 1185 => 35.0, 1327 => 0.0, 1893 => 10.5, 1610 => 95.0, 1469 => 0.2887433201, 1752 => 0.0901367486, 1186 => 7.0, 1328 => 0.0, 1894 => 6.4598003135, 1611 => 42.5, 1753 => 0.0065887631, 1470 => 17.25, 1187 => 350.0, 1046 => 12.124215848, 1612 => 25.0, 1329 => 3.9341869568, 1754 => 0.0059576687, 1471 => 16.77, 1188 => 262.5, 1330 => 1.1018913972, 1047 => 9.125, 1896 => 1.5, 1613 => 15.0, 1189 => 210.0, 1755 => 0.0233230552, 1897 => 3.9096986181, 1614 => 7.95, 1048 => 0.35, 1756 => 0.1181244148, 1190 => 18.5, 1898 => 60.35, 1615 => 2.48307995, 1332 => 7.5, 1757 => 0.0575, 1474 => 120.0, 1191 => 0.02095, 1616 => 5.1362169319, 1333 => 22000.0, 1050 => 12.25, 1899 => 13.3, 1758 => 2.7812743306, 1475 => 362.5, 1192 => 2.025, 1051 => 0.8003546187, 1617 => 70.0, 1334 => 2.96, 1759 => 0.0078269429, 1476 => 9.277114, 1052 => 0.0030525403, 1618 => 27.5, 1335 => 6.65, 1760 => 0.0061737499, 1477 => 2.6207568331, 1194 => 8.0, 1619 => 0.25, 1336 => 14.7229498955, 1053 => 52.5, 1902 => 11.159738919, 1195 => 0.0, 1761 => 0.0078886804, 1478 => 26.2, 1337 => 0.0834334443, 1620 => 0.0945, 1054 => 13.9080865834, 1196 => 0.0, 1762 => 0.0033201055, 1479 => 131.9419564613, 1338 => 0.7880414707, 1621 => 0.0525, 1055 => 21.0785541078, 1904 => 24.0, 1763 => 0.096, 1480 => 13.2, 1197 => 0.015, 1622 => 0.0525, 1056 => 13.0, 1905 => 0.6293795038, 1764 => 0.1011, 1481 => 840.0, 1198 => 0.058, 1623 => 1.05, 1340 => 6.8, 1906 => 16.28, 1765 => 0.25, 1482 => 0.1524215, 1199 => 0.0305, 1624 => 0.825, 1341 => 0.575, 1058 => 12.4, 1907 => 0.087, 1766 => 1.86, 1483 => 17.318378, 1200 => 0.049, 1059 => 0.0, 1625 => 0.882400354, 1342 => 3.6820805414, 1908 => 0.07875, 1767 => 14.576943788, 1484 => 8.5746526408, 1201 => 0.085, 1626 => 8.86, 1343 => 7.0, 1060 => 46.75, 1909 => 0.625, 1202 => 101.0, 1485 => 3.1398527348, 1768 => 13.6880952953, 1627 => 0.4231762571, 1344 => 1.4628806475, 1061 => 29.25, 1910 => 0.2, 1203 => 0.2857142857, 1486 => 51.8433788247, 1769 => 0.15005, 1628 => 4.16, 1345 => 43.8864194255, 1062 => 3.9463981314, 1911 => 0.4836104089, 1487 => 237.5, 1204 => 0.19, 1770 => 0.20005, 1629 => 33.0, 1346 => 0.577931588, 1063 => 14.5, 1912 => 0.4182372572, 1488 => 116.0, 1205 => 5150.0, 1771 => 0.0350703293, 1347 => 0.2135448444, 1630 => 487.5, 1064 => 5.5, 1913 => 5.6623576179, 1489 => 3.9527433744, 1206 => 62.5, 1772 => 0.0400950757, 1631 => 4.395, 1348 => 0.9, 1065 => 0.03, 1914 => 5.19, 1490 => 809.94, 1773 => 2.34, 1207 => 55.0, 1632 => 1.9138624694, 1349 => 1025.0, 1066 => 56.7102390337, 1491 => 50.75, 1208 => 1700.0, 1774 => 35.0, 1633 => 1.845, 1067 => 0.3937565954, 1916 => 2.075, 1492 => 1.5995872033, 1209 => 255.0, 1775 => 18.5, 1351 => 0.0341382028, 1634 => 1.5, 1068 => 11.5, 1917 => 0.5505, 1493 => 7.360824813, 1210 => 87.5, 1776 => 0.42, 1352 => 241.615062462, 1635 => 0.075, 1069 => 8.0, 1918 => 3.0011284243, 1494 => 7.26, 1211 => 0.0138154803, 1777 => 0.34, 1636 => 150.0, 1353 => 3.15, 1070 => 300.0, 1919 => 15.0056421214, 1212 => 5.0, 1778 => 0.3, 1637 => 150.0, 1354 => 0.041047242, 1071 => 35.0, 1496 => 0.375, 1213 => 840.0, 1779 => 0.0245063572, 1355 => 0.0, 1072 => 0.1975308642, 1921 => 2.1371464242, 1638 => 115.5, 1497 => 0.40114525, 1214 => 467.5, 1780 => 0.034041371, 1356 => 292.5, 1073 => 4.735, 1639 => 0.35, 1215 => 3.4, 1498 => 39.25, 1781 => 3.4041370984, 1357 => 2.2198060757, 1074 => 20.25, 1923 => 142.6391561069, 1640 => 0.325, 1499 => 9.025, 1216 => 115.0, 1782 => 0.0526998151, 1075 => 1.31, 1358 => 1.5077669204, 1924 => 39.8358, 1641 => 38.025, 1500 => 50.0, 1217 => 3450.0, 1783 => 0.0518766485, 1359 => 0.0369394439, 1076 => 0.469623, 1925 => 60.0411994958, 1642 => 999.0, 1501 => 4.3219679171, 1218 => 24.0, 1784 => 0.0828654431, 1360 => 0.0443273327, 1077 => 0.007, 1926 => 14.75, 1643 => 290.0, 1502 => 18.1, 1219 => 6.125, 1785 => 0.0280905621, 1078 => 0.0, 1361 => 1.5, 1927 => 15.0, 1644 => 1.24, 1220 => 0.0, 1503 => 0.568491, 1786 => 1.5773930998, 1362 => 0.0059, 1079 => 6.0, 1928 => 6.9461546113, 1645 => 0.6, 1221 => 0.0, 1787 => 1.8418353872, 1363 => 0.28, 1080 => 39.4434021478, 1929 => 44.94, 1646 => 3.135, 1505 => 12.275, 1222 => 0.0038, 1788 => 0.0255816126, 1364 => 34.175, 1081 => 67.6, 1930 => 0.4510953261, 1647 => 1.16, 1223 => 0.00266, 1789 => 0.0162709903, 1506 => 3.1, 1648 => 21.0554830448, 1365 => 40.5, 1082 => 1.0, 1931 => 0.3668922372, 1507 => 188.5224098949, 1224 => 15.4333457952, 1790 => 0.0378557824, 1083 => 3.73, 1366 => 0.0019858896, 1932 => 6.6196318387, 1649 => 1.37830231, 1508 => 29.8438173558, 1225 => 52.0, 1791 => 0.0321508806, 1367 => 4.0, 1084 => 5.4, 1933 => 2.2054006592, 1650 => 0.1482183, 1226 => 21.25, 1792 => 0.962058877, 1509 => 42.75, 1368 => 3.1770483969, 1085 => 15.0, 1934 => 0.0341957147, 1651 => 2.675, 1227 => 80.5, 1793 => 0.9432117905, 1510 => 19.5, 1369 => 0.05495, 1086 => 308.0, 1935 => 0.0250379857, 1652 => 0.955, 1794 => 1.0466175783, 1228 => 80.0, 1511 => 2.8136317207, 1370 => 122.5, 1087 => 24.5, 1936 => 0.0695, 1653 => 27.5, 1795 => 0.572561381, 1229 => 0.275, 1512 => 84.0, 1371 => 0.02025, 1088 => 2.0, 1937 => 1.95, 1654 => 18.125, 1796 => 0.0, 1230 => 5.0, 1513 => 80.0, 1372 => 55.0, 1089 => 23.5, 1938 => 0.049, 1655 => 430.0, 1231 => 0.3016721255, 1797 => 1.212616, 1514 => 97.5, 1373 => 0.155, 1090 => 1250.0, 1939 => 0.0034298611, 1656 => 1200.0, 1232 => 0.028, 1798 => 0.0040129374, 1515 => 47.5, 1940 => 0.067859801, 1374 => 16.25, 1091 => 62.5, 1657 => 155.0, 1233 => 0.028, 1799 => 0.0033955624, 1516 => 34.5, 1092 => 17.5, 1658 => 85.0, 1375 => 16.0, 1234 => 35.0, 1800 => 0.1414817686, 1517 => 77.0, 1093 => 0.0, 1376 => 3.3861156943, 1942 => 0.0237346385, 1659 => 445.0, 1235 => 2.02362e-05, 1801 => 0.22995, 1518 => 74.505, 1094 => 0.3, 1943 => 0.0194130136, 1660 => 3.4, 1377 => 391.0, 1236 => 1.41653e-05, 1802 => 0.04, 1519 => 69.8309404336, 1095 => 0.1832, 1661 => 1.025, 1378 => 16.0, 1237 => 10.6, 1803 => 0.0575, 1520 => 887.5, 1096 => 0.5058359086, 1662 => 0.52, 1379 => 305.0, 1521 => 0.3404585416, 1238 => 470.0, 1804 => 0.00575, 1097 => 0.1025, 1946 => 2.1059346886, 1380 => 22.0, 1522 => 0.956733699, 1239 => 2.775, 1805 => 0.0078, 1381 => 0.2892069171, 1098 => 90.0, 1947 => 4.1, 1664 => 4.85, 1240 => 1.2, 1806 => 0.0012, 1523 => 289.5, 1382 => 0.0, 1099 => 3285.0, 1948 => 1.5743062249, 1665 => 250.05, 1241 => 0.25, 1807 => 0.0008, 1100 => 890.0, 1666 => 135.0, 1383 => 1.125, 1525 => 0.0053833547, 1808 => 1.4814814815, 1242 => 0.0835, 1101 => 35.0, 1950 => 123.5, 1667 => 45.0, 1384 => 9.0, 1243 => 0.38, 1809 => 200.5, 1526 => 16.5749519326, 1102 => 7.55, 1951 => 17.52, 1668 => 7.05, 1385 => 165.5, 1244 => 375.0, 1810 => 2.0, 1527 => 119.2921996156, 1103 => 3.5, 1952 => 1.3719444225, 1386 => 0.0825, 1245 => 262.5, 1811 => 0.25, 1104 => 110.0, 1953 => 3.5, 1670 => 16.25, 1387 => 0.07995, 1812 => 0.0425, 1529 => 1.19416475, 1246 => 13.0, 1105 => 5.5, 1954 => 4.55, 1388 => 138.5, 1813 => 0.03025, 1530 => 10.62, 1247 => 15.0, 1106 => 72.5, 1955 => 63.0, 1672 => 25.832684518, 1389 => 20.0, 1814 => 0.425, 1531 => 6.5, 1248 => 5.9165103222, 1673 => 0.69, 1107 => 60.5, 1956 => 82.5, 1390 => 50.0, 1815 => 0.0085, 1532 => 16.75, 1249 => 45.5, 1108 => 32.5, 1957 => 349.5, 1674 => 0.004, 1391 => 23.2, 1816 => 0.0035670555, 1533 => 8.2, 1250 => 38.0, 1109 => 85.0, 1958 => 150.0, 1675 => 0.0007568834, 1392 => 29.0, 1251 => 0.0, 1817 => 0.3, 1534 => 155.0, 1110 => 0.0, 1393 => 42.0, 1959 => 0.33, 1676 => 0.0167720206, 1252 => 0.0, 1818 => 0.0378656661, 1535 => 1.03, 1111 => 45.4564344991, 1677 => 0.9344656448, 1394 => 225.0, 1819 => 0.0200646872, 1536 => 240.0, 1253 => 400.0, 1395 => 0.0298705178, 1112 => 5.2330878913, 1961 => 8.8, 1678 => 0.6516736007, 1254 => 280.0, 1820 => 0.0030182777, 1537 => 11.183532, 1962 => 19.0, 1679 => 8.75, 1396 => 15.91, 1113 => 64.0, 1821 => 0.0021951111, 1538 => 0.346038, 1255 => 750.0, 1114 => 0.0307828699, 1963 => 550.0, 1680 => 7.5, 1822 => 0.35, 1256 => 350.0, 1964 => 0.76, 1681 => 0.7, 1398 => 10.276161, 1115 => 101.0, 1257 => 0.017, 1823 => 0.0004630312, 1540 => 6.772458, 1116 => 0.3324549954, 1682 => 0.162501596, 1399 => 0.0418238013, 1965 => 56.5, 1824 => 1.3676570962, 1258 => 0.055, 1117 => 25.0, 1683 => 0.0206820622, 1400 => 6.0, 1966 => 580.0, 1825 => 0.0004664611, 1259 => 0.0375, 1684 => 1.2362400571, 1118 => 2450.0, 1967 => 425.0, 1826 => 0.0019275819, 1543 => 16.5, 1260 => 0.45, 1685 => 12.773978, 1402 => 1.521, 1119 => 1.5, 1968 => 1.35, 1261 => 5.0, 1827 => 0.0001097556, 1544 => 6.0334685842, 1686 => 0.0056935694, 1403 => 0.05, 1120 => 0.4, 1969 => 0.1605, 1828 => 0.0002315156, 1545 => 24.15, 1262 => 1.075, 1687 => 0.0024009027, 1404 => 1.75, 1121 => 27.4, 1970 => 2.4, 1829 => 2.315156213, 1546 => 20.25, 1263 => 1.025, 1688 => 0.7695717487, 1122 => 15.076, 1971 => 0.64375, 1830 => 0.0002092215, 1547 => 10.0, 1264 => 4.2875, 1689 => 0.9856674958, 1123 => 25.75, 1972 => 130.0, 1831 => 0.0003258368, 1548 => 0.116, 1265 => 2.775, 1124 => 32.0, 1690 => 1.0712438742, 1973 => 85.0, 1549 => 0.05, 1832 => 0.0002057917, 1266 => 90.0, 1691 => 0.004493118, 1125 => 875.0, 1974 => 90.5, 1833 => 0.0003978639, 1550 => 17.7313283, 1267 => 62.5, 1692 => 0.0095693123, 1409 => 3.235, 1126 => 0.27672119, 1975 => 0.1625, 1551 => 0.0017241379, 1268 => 85.0, 1834 => 0.0003498458, 1410 => 0.0148989091, 1693 => 25.25, 1127 => 26.8, 1976 => 87.5, 1269 => 0.0, 1835 => 0.0451026729, 1411 => 6000.0, 1694 => 15.175, 1128 => 75.0, 1977 => 61.25, 1553 => 3.29, 1270 => 81.0, 1836 => 4.5102672891, 1695 => 0.000617375, 1412 => 0.76755, 1129 => 32.5, 1978 => 950.0, 1554 => 4.539689, 1271 => 3.05, 1837 => 0.00113, 1696 => 94.2822384428, 1413 => 0.0, 1130 => 153.5, 1979 => 279.0, 1272 => 2.5, 1838 => 0.0001166153, 1414 => 0.0, 1697 => 36.508773, 1131 => 0.0})
159
+ wherever.add({"position" => 1953}, {"keys" => {"technical_instrument_id" => 1345, "fund_id" => 8}, "unique" => {"trade_id" => 8445, "version" => 4}})
160
+ wherever.add({"position" => 1953}, {"keys" => {"technical_instrument_id" => 1345, "fund_id" => 8}, "unique" => {"trade_id" => 8446, "version" => 5}})
161
+ wherever.add({"position" => 9474053099}, {"keys" => {"technical_instrument_id" => 1831, "fund_id" => 4}, "unique" => {"trade_id" => 8447, "version" => 5}})
162
+ wherever.add({"position" => 1678}, {"keys" => {"technical_instrument_id" => 1982, "fund_id" => 6}, "unique" => {"trade_id" => 8448, "version" => 5}})
163
+ wherever.add({"position" => 38}, {"keys" => {"technical_instrument_id" => 1411, "fund_id" => 8}, "unique" => {"trade_id" => 8449, "version" => 5}})
164
+ wherever.add({"position" => 6320}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8450, "version" => 4}})
165
+ wherever.add({"position" => 6320}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8451, "version" => 5}})
166
+ wherever.add({"position" => 62}, {"keys" => {"technical_instrument_id" => 1411, "fund_id" => 3}, "unique" => {"trade_id" => 8452, "version" => 5}})
167
+ wherever.add({"position" => 4678}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8453, "version" => 8}})
168
+ wherever.add({"position" => 4678}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8454, "version" => 9}})
169
+ wherever.add({"position" => 1175840}, {"keys" => {"technical_instrument_id" => 1310, "fund_id" => 3}, "unique" => {"trade_id" => 8455, "version" => 5}})
170
+ wherever.add({"position" => 20000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 3}, "unique" => {"trade_id" => 8456, "version" => 5}})
171
+ wherever.add({"position" => 3000}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 3}, "unique" => {"trade_id" => 8457, "version" => 6}})
172
+ wherever.add({"position" => 23350}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 3}, "unique" => {"trade_id" => 8458, "version" => 5}})
173
+ wherever.add({"position" => 595316}, {"keys" => {"technical_instrument_id" => 1310, "fund_id" => 7}, "unique" => {"trade_id" => 8459, "version" => 5}})
174
+ wherever.add({"position" => 180000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 7}, "unique" => {"trade_id" => 8460, "version" => 4}})
175
+ wherever.add({"position" => 5604}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 7}, "unique" => {"trade_id" => 8461, "version" => 5}})
176
+ wherever.add({"position" => 33000}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 7}, "unique" => {"trade_id" => 8462, "version" => 6}})
177
+ wherever.add({"position" => 114000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 11}, "unique" => {"trade_id" => 8463, "version" => 4}})
178
+ wherever.add({"position" => 195000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 11}, "unique" => {"trade_id" => 8464, "version" => 6}})
179
+ wherever.add({"position" => 225000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 11}, "unique" => {"trade_id" => 8465, "version" => 6}})
180
+ wherever.add({"position" => 1000}, {"keys" => {"technical_instrument_id" => 1982, "fund_id" => 5}, "unique" => {"trade_id" => 8466, "version" => 8}})
181
+ wherever.add({"position" => 20000}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8467, "version" => 5}})
182
+ wherever.add({"position" => 20000}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8468, "version" => 6}})
183
+ wherever.add({"position" => 13900}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8469, "version" => 7}})
184
+ wherever.add({"position" => 13900}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8470, "version" => 8}})
185
+ wherever.add({"position" => 5000}, {"keys" => {"technical_instrument_id" => 1122, "fund_id" => 11}, "unique" => {"trade_id" => 8471, "version" => 4}})
186
+ wherever.add({"position" => 250000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 7}, "unique" => {"trade_id" => 8472, "version" => 8}})
187
+ wherever.add({"position" => 199817763}, {"keys" => {"technical_instrument_id" => 1762, "fund_id" => 7}, "unique" => {"trade_id" => 8473, "version" => 3}})
188
+ wherever.add({"position" => 950000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8474, "version" => 4}})
189
+ wherever.add({"position" => 950000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8475, "version" => 5}})
190
+ wherever.add({"position" => 50000}, {"keys" => {"technical_instrument_id" => 1046, "fund_id" => 3}, "unique" => {"trade_id" => 8476, "version" => 4}})
191
+ wherever.add({"position" => 50000}, {"keys" => {"technical_instrument_id" => 1046, "fund_id" => 3}, "unique" => {"trade_id" => 8477, "version" => 5}})
192
+ wherever.add({"position" => 800}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 6}, "unique" => {"trade_id" => 8478, "version" => 3}})
193
+ wherever.add({"position" => 800}, {"keys" => {"technical_instrument_id" => 1699, "fund_id" => 6}, "unique" => {"trade_id" => 8479, "version" => 4}})
194
+ wherever.add({"position" => 100000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 5}, "unique" => {"trade_id" => 8480, "version" => 1}})
195
+ wherever.add({"position" => 90000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 7}, "unique" => {"trade_id" => 8481, "version" => 1}})
196
+ wherever.add({"position" => 10288}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 3}, "unique" => {"trade_id" => 8482, "version" => 1}})
197
+ wherever.add({"position" => 200000000}, {"keys" => {"technical_instrument_id" => 1762, "fund_id" => 7}, "unique" => {"trade_id" => 8483, "version" => 4}})
198
+ wherever.add({"position" => 18522}, {"keys" => {"technical_instrument_id" => 1632, "fund_id" => 10}, "unique" => {"trade_id" => 8484, "version" => 2}})
199
+ wherever.add({"position" => 7260400}, {"keys" => {"technical_instrument_id" => 1935, "fund_id" => 10}, "unique" => {"trade_id" => 8485, "version" => 2}})
200
+ wherever.add({"position" => 7600}, {"keys" => {"technical_instrument_id" => 1579, "fund_id" => 7}, "unique" => {"trade_id" => 8486, "version" => 1}})
201
+ wherever.add({"position" => 800}, {"keys" => {"technical_instrument_id" => 1579, "fund_id" => 3}, "unique" => {"trade_id" => 8487, "version" => 1}})
202
+ wherever.add({"position" => 17370}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 7}, "unique" => {"trade_id" => 8488, "version" => 1}})
203
+ wherever.add({"position" => 1930}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 3}, "unique" => {"trade_id" => 8489, "version" => 1}})
204
+ wherever.add({"position" => 500000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 5}, "unique" => {"trade_id" => 8490, "version" => 1}})
205
+ wherever.add({"position" => 10000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8491, "version" => 5}})
206
+ wherever.add({"position" => 9000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8492, "version" => 4}})
207
+ wherever.add({"position" => 2694400}, {"keys" => {"technical_instrument_id" => 1755, "fund_id" => 9}, "unique" => {"trade_id" => 8493, "version" => 1}})
208
+ wherever.add({"position" => 9720}, {"keys" => {"technical_instrument_id" => 1046, "fund_id" => 8}, "unique" => {"trade_id" => 8494, "version" => 8}})
209
+ wherever.add({"position" => 8280}, {"keys" => {"technical_instrument_id" => 1046, "fund_id" => 3}, "unique" => {"trade_id" => 8495, "version" => 7}})
210
+ wherever.add({"position" => 20}, {"keys" => {"technical_instrument_id" => 1287, "fund_id" => 8}, "unique" => {"trade_id" => 8496, "version" => 9}})
211
+ wherever.add({"position" => 70000000}, {"keys" => {"technical_instrument_id" => 1762, "fund_id" => 7}, "unique" => {"trade_id" => 8497, "version" => 6}})
212
+ wherever.add({"position" => 150000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8498, "version" => 9}})
213
+ wherever.add({"position" => 150000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8499, "version" => 10}})
214
+ wherever.add({"position" => 500}, {"keys" => {"technical_instrument_id" => 1982, "fund_id" => 3}, "unique" => {"trade_id" => 8500, "version" => 8}})
215
+ wherever.add({"position" => 25000}, {"keys" => {"technical_instrument_id" => 1634, "fund_id" => 3}, "unique" => {"trade_id" => 8501, "version" => 6}})
216
+ wherever.add({"position" => 1008353}, {"keys" => {"technical_instrument_id" => 1310, "fund_id" => 7}, "unique" => {"trade_id" => 8502, "version" => 6}})
217
+ wherever.add({"position" => 1991647}, {"keys" => {"technical_instrument_id" => 1310, "fund_id" => 3}, "unique" => {"trade_id" => 8503, "version" => 6}})
218
+ wherever.add({"position" => 3563}, {"keys" => {"technical_instrument_id" => 1579, "fund_id" => 3}, "unique" => {"trade_id" => 8504, "version" => 7}})
219
+ wherever.add({"position" => 20643}, {"keys" => {"technical_instrument_id" => 1579, "fund_id" => 7}, "unique" => {"trade_id" => 8505, "version" => 7}})
220
+ wherever.add({"position" => 25000}, {"keys" => {"technical_instrument_id" => 1898, "fund_id" => 6}, "unique" => {"trade_id" => 8506, "version" => 7}})
221
+ wherever.add({"position" => 15000}, {"keys" => {"technical_instrument_id" => 1050, "fund_id" => 10}, "unique" => {"trade_id" => 8507, "version" => 1}})
222
+ wherever.add({"position" => 10350}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8508, "version" => 1}})
223
+ wherever.add({"position" => 1050}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 7}, "unique" => {"trade_id" => 8509, "version" => 1}})
224
+ wherever.add({"position" => 3600}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8510, "version" => 1}})
225
+ wherever.add({"position" => 9000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8511, "version" => 1}})
226
+ wherever.add({"position" => 166}, {"keys" => {"technical_instrument_id" => 1266, "fund_id" => 8}, "unique" => {"trade_id" => 8512, "version" => 6}})
227
+ wherever.add({"position" => 174}, {"keys" => {"technical_instrument_id" => 1266, "fund_id" => 11}, "unique" => {"trade_id" => 8513, "version" => 6}})
228
+ wherever.add({"position" => 660}, {"keys" => {"technical_instrument_id" => 1266, "fund_id" => 6}, "unique" => {"trade_id" => 8514, "version" => 7}})
229
+ wherever.add({"position" => 1500}, {"keys" => {"technical_instrument_id" => 1122, "fund_id" => 8}, "unique" => {"trade_id" => 8515, "version" => 8}})
230
+ wherever.add({"position" => 1008353}, {"keys" => {"technical_instrument_id" => 1310, "fund_id" => 7}, "unique" => {"trade_id" => 8516, "version" => 5}})
231
+ wherever.add({"position" => 1000000}, {"keys" => {"technical_instrument_id" => 1627, "fund_id" => 10}, "unique" => {"trade_id" => 8517, "version" => 1}})
232
+ wherever.add({"position" => 195000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 11}, "unique" => {"trade_id" => 8518, "version" => 7}})
233
+ wherever.add({"position" => 195000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8519, "version" => 7}})
234
+ wherever.add({"position" => 225000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 11}, "unique" => {"trade_id" => 8520, "version" => 7}})
235
+ wherever.add({"position" => 9545}, {"keys" => {"technical_instrument_id" => 1632, "fund_id" => 10}, "unique" => {"trade_id" => 8521, "version" => 1}})
236
+ wherever.add({"position" => 225000}, {"keys" => {"technical_instrument_id" => 1905, "fund_id" => 8}, "unique" => {"trade_id" => 8522, "version" => 8}})
237
+ wherever.add({"position" => 43}, {"keys" => {"technical_instrument_id" => 1411, "fund_id" => 9}, "unique" => {"trade_id" => 8523, "version" => 11}})
238
+ wherever.add({"position" => 800}, {"keys" => {"technical_instrument_id" => 1579, "fund_id" => 3}, "unique" => {"trade_id" => 8524, "version" => 2}})
239
+ wherever.add({"position" => 1930}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 3}, "unique" => {"trade_id" => 8525, "version" => 2}})
240
+ wherever.add({"position" => 7600}, {"keys" => {"technical_instrument_id" => 1579, "fund_id" => 7}, "unique" => {"trade_id" => 8526, "version" => 2}})
241
+ wherever.add({"position" => 17370}, {"keys" => {"technical_instrument_id" => 1544, "fund_id" => 7}, "unique" => {"trade_id" => 8527, "version" => 2}})
242
+ wherever.add({"position" => 18522}, {"keys" => {"technical_instrument_id" => 1632, "fund_id" => 10}, "unique" => {"trade_id" => 8528, "version" => 3}})
243
+ wherever.add({"position" => 7260400}, {"keys" => {"technical_instrument_id" => 1935, "fund_id" => 10}, "unique" => {"trade_id" => 8529, "version" => 3}})
244
+ wherever.add({"position" => 2694400}, {"keys" => {"technical_instrument_id" => 1755, "fund_id" => 9}, "unique" => {"trade_id" => 8530, "version" => 2}})
245
+ wherever.add({"position" => 100000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 5}, "unique" => {"trade_id" => 8531, "version" => 2}})
246
+ wherever.add({"position" => 90000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 7}, "unique" => {"trade_id" => 8532, "version" => 2}})
247
+ wherever.add({"position" => 10288}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 3}, "unique" => {"trade_id" => 8533, "version" => 2}})
248
+ wherever.add({"position" => 9545}, {"keys" => {"technical_instrument_id" => 1632, "fund_id" => 10}, "unique" => {"trade_id" => 8534, "version" => 2}})
249
+ wherever.add({"position" => 500000}, {"keys" => {"technical_instrument_id" => 1633, "fund_id" => 5}, "unique" => {"trade_id" => 8535, "version" => 2}})
250
+ wherever.add({"position" => 10350}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 5}, "unique" => {"trade_id" => 8536, "version" => 2}})
251
+ wherever.add({"position" => 3600}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 3}, "unique" => {"trade_id" => 8537, "version" => 2}})
252
+ wherever.add({"position" => 1050}, {"keys" => {"technical_instrument_id" => 1058, "fund_id" => 7}, "unique" => {"trade_id" => 8538, "version" => 2}})
253
+ wherever.add({"position" => 6000000}, {"keys" => {"technical_instrument_id" => 1835, "fund_id" => 10}, "unique" => {"trade_id" => 8539, "version" => 1}})
254
+ wherever.add({"position" => 15000}, {"keys" => {"technical_instrument_id" => 1050, "fund_id" => 10}, "unique" => {"trade_id" => 8540, "version" => 2}})
255
+ wherever.add({"position" => 6000000}, {"keys" => {"technical_instrument_id" => 1835, "fund_id" => 10}, "unique" => {"trade_id" => 8541, "version" => 2}})
256
+ wherever.add({"position" => 9000}, {"keys" => {"technical_instrument_id" => 1929, "fund_id" => 10}, "unique" => {"trade_id" => 8542, "version" => 2}})
257
+ wherever.add({"position" => 1000000}, {"keys" => {"technical_instrument_id" => 1627, "fund_id" => 10}, "unique" => {"trade_id" => 8543, "version" => 2}})
258
+ wherever.set_price("2009-11-02", {1273 => 0.0, 1556 => 0.315, 990 => 12.2066055174, 1839 => 0.0100031174, 1698 => 36.6076876144, 1415 => 0.12693725, 1132 => 0.4, 0 => 1.1339636281, 1557 => 189.0, 1274 => 95.0, 991 => 265.0, 1840 => 0.0074509522, 1416 => 1.3117754728, 1699 => 7.3215375229, 1133 => 53.5, 1982 => 857.0739442772, 1558 => 124.5, 1275 => 52.5, 992 => 3.745639618, 1841 => 0.0019184061, 1700 => 1.0, 1417 => 0.476148975, 1134 => 15.0, 1983 => 0.03, 1559 => 79.5, 1276 => 0.0875, 993 => 14.6479266209, 1842 => 0.0022952358, 1984 => 250.0, 1135 => 0.0585723002, 1701 => 0.0070826867, 1418 => 0.2975, 1560 => 145.0, 1277 => 0.15, 1843 => 0.0053, 1136 => 1.8456375839, 1419 => 1.4643075046, 1702 => 0.0072693887, 1985 => 0.3221209349, 1278 => 0.0084, 1561 => 65.0, 995 => 19.226355, 1844 => 0.0044, 1420 => 0.0, 1137 => 1.1655962608, 1986 => 32.2120934949, 1703 => 0.0170943685, 1279 => 0.0024, 1562 => 27.5, 996 => 1.7837408233, 1845 => 0.0154500204, 1987 => 0.0, 1421 => 0.0, 1138 => 35.5, 1704 => 0.0109965777, 1280 => 0.0105, 1563 => 14.1, 1846 => 0.0256586813, 1422 => 0.3081147041, 1705 => 0.4250151791, 1139 => 6.95, 1281 => 0.0084, 1564 => 4.0, 1847 => 0.0127436975, 1140 => 3.65, 1423 => 0.0547935085, 1706 => 0.0355247697, 1565 => 58.5631138471, 1282 => 6.5, 999 => 0.14, 1848 => 0.0679321295, 1424 => 0.6475, 1141 => 0.605, 1707 => 3.6, 1566 => 58.7, 1283 => 48.5, 1849 => 0.0758626832, 1425 => 5.0, 1142 => 0.3375, 1708 => 0.0010242918, 1567 => 19.884009942, 1284 => 27.5, 1001 => 105.0, 1850 => 0.14, 1426 => 4.225, 1709 => 0.4655903038, 1002 => 0.0, 1568 => 16.5, 1851 => 0.135, 1427 => 14.5, 1144 => 1.025, 1710 => 0.0049330842, 1852 => 18.3099450885, 1569 => 8.7349139629, 1286 => 3.0, 1003 => 160.0, 1145 => 1.9920683344, 1428 => 13.5, 1711 => 0.0050491567, 1570 => 17.4698279258, 1287 => 155.0, 1004 => 340.0, 1853 => 0.2399035316, 1429 => 9.007662, 1146 => 0.7, 1712 => 0.02255, 1005 => 0.0610128127, 1571 => 105.0, 1288 => 1.15, 1854 => 0.0304204392, 1430 => 157.0, 1147 => 0.445, 1713 => 0.378542628, 1289 => 70.0, 1006 => 57.0, 1855 => 0.0266521416, 1572 => 21.0, 1431 => 1.375, 1148 => 1800.0, 1714 => 0.0105, 1573 => 2100.0, 1290 => 52.5, 1007 => 2729.0011613208, 1856 => 0.3836812157, 1432 => 2.75, 1149 => 35.0, 1715 => 0.0101, 1574 => 1700.0, 1857 => 0.0640634533, 1291 => 58.0, 1008 => 700.0, 1150 => 0.0298962782, 1433 => 0.5491153142, 1716 => 0.3965832825, 1009 => 0.0, 1292 => 43.75, 1858 => 0.1301432981, 1575 => 0.475, 1717 => 0.1185662963, 1434 => 22.25, 1151 => 3600.0, 1293 => 60.5, 1010 => 10.25, 1859 => 0.1339115957, 1576 => 0.1475, 1152 => 0.0, 1435 => 23.0, 1718 => 0.0047275007, 1294 => 30.5, 1011 => 92.5, 1860 => 0.365, 1577 => 2.55, 1153 => 0.3929225137, 1436 => 14.3725725, 1719 => 0.0022609786, 1295 => 2.735, 1012 => 35.0, 1861 => 0.011990038, 1578 => 0.095, 1154 => 2.9286150092, 1720 => 0.2643941071, 1296 => 1.5, 1013 => 660.0, 1862 => 0.0137, 1579 => 7.7363150845, 1438 => 24.97, 1155 => 220.5, 1721 => 0.0657739227, 1297 => 0.0, 1014 => 10000.0, 1863 => 0.5792216067, 1580 => 7.8, 1439 => 2.4453847, 1156 => 380.0, 1722 => 0.0615, 1581 => 0.0, 1298 => 0.0009011106, 1015 => 4155.7471677817, 1864 => 0.5626582257, 1440 => 3.375528, 1157 => 127.5, 1723 => 0.0011, 1865 => 0.9579011592, 1299 => 0.0009011106, 1016 => 23.5, 1582 => 4.775, 1724 => 0.0011, 1158 => 600.0, 1441 => 259.0, 1866 => 39.7516778523, 1017 => 1.0892035, 1583 => 1.25, 1442 => 0.0, 1159 => 195.0, 1725 => 0.0099859888, 1301 => 29.7484832602, 1018 => 1.8255, 1867 => 11.587676, 1584 => 0.451, 1443 => 0.0, 1160 => 0.0005027252, 1726 => 0.0049673015, 1868 => 0.4093959732, 1302 => 77.5, 1019 => 0.6505, 1585 => 47.5, 1161 => 0.0002, 1727 => 0.045, 1444 => 0.1064635, 1869 => 0.3971934106, 1303 => 262.5, 1020 => 361.0, 1586 => 35.5, 1162 => 15.8, 1728 => 0.04345, 1445 => 0.3628244488, 1304 => 112.5, 1021 => 200.0, 1587 => 142.502071251, 1163 => 7.375, 1729 => 1.438804559, 1446 => 1.375836, 1022 => 0.0, 1305 => 777.3747983104, 1871 => 2.06, 1588 => 24.01, 1730 => 0.4623587066, 1164 => 14.0, 1306 => 12.4, 1023 => 0.031, 1589 => 41.4250207125, 1165 => 5.55, 1731 => 0.19, 1448 => 12.662322, 1307 => 12.1005, 1024 => 0.0205, 1873 => 2.0, 1590 => 68.0, 1166 => 35.0, 1732 => 0.4796015197, 1449 => 80.0, 1308 => 0.0029139907, 1025 => 0.9625, 1874 => 30.7, 1591 => 65.0, 1167 => 47.5899938987, 1733 => 4.3170988219, 1450 => 32.5, 1875 => 5.7, 1309 => 0.481280125, 1026 => 14.995, 1592 => 19.0, 1168 => 2100.0, 1734 => 0.525, 1451 => 1245.0, 1027 => 0.19, 1593 => 20.25, 1310 => 0.341202224, 1169 => 1497.5, 1735 => 0.3675, 1028 => 0.04805, 1877 => 7.4, 1594 => 1.42906775, 1311 => 14.7306181036, 1170 => 170.0, 1736 => 0.05025, 1453 => 8.25, 1029 => 61.15, 1878 => 2.62064, 1595 => 7.0661173852, 1312 => 410.0, 1171 => 657.5, 1737 => 0.04525, 1454 => 8.25, 1030 => 61.15, 1879 => 51.0, 1596 => 6.9263085026, 1313 => 150.5, 1738 => 0.0885, 1455 => 18.573786, 1031 => 3.875, 1597 => 0.6, 1314 => 1.575, 1173 => 210.0, 1739 => 0.005995019, 1456 => 75.0, 1032 => 1.05, 1881 => 3.94, 1598 => 0.625, 1315 => 1.65, 1457 => 103.096201021, 1174 => 143.0, 1740 => 0.876112076, 1033 => 26.25, 1882 => 0.70020225, 1599 => 35.0, 1316 => 95.0, 1175 => 0.0, 1741 => 0.7699317253, 1458 => 10.0, 1034 => 12.0, 1883 => 1.775, 1600 => 28.5, 1317 => 2.9091257892, 1459 => 0.2104942038, 1176 => 155.8877364246, 1742 => 0.0517455782, 1884 => 32.1846876938, 1601 => 0.035, 1318 => 689.1812174342, 1460 => 0.6101281269, 1743 => 0.5185185185, 1177 => 37.486, 1885 => 1.55, 1602 => 0.0475, 1319 => 671.4417917913, 1178 => 0.0925802219, 1744 => 0.0355, 1461 => 530.0, 1886 => 0.067114094, 1037 => 3.75, 1603 => 2.75, 1320 => 340.0, 1745 => 0.0315, 1462 => 260.0, 1179 => 1.825, 1038 => 0.01, 1887 => 0.3621505332, 1604 => 1.125, 1321 => 19.0, 1746 => 0.155, 1463 => 1421.6759332532, 1180 => 2.7, 1039 => 26.3777410083, 1888 => 0.1410199754, 1605 => 2.05, 1322 => 4.5, 1747 => 0.012, 1181 => 56.5, 1040 => 26.309569078, 1889 => 0.37054575, 1606 => 0.475, 1323 => 22.45, 1748 => 0.0068857075, 1465 => 0.0, 1182 => 9.125, 1607 => 80.0, 1324 => 6.7977583977, 1749 => 0.0073653091, 1466 => 2.1, 1183 => 0.02015, 1042 => 1.75, 1891 => 0.88, 1608 => 240.0, 1325 => 0.2265919466, 1750 => 0.0235347317, 1184 => 0.02, 1043 => 1.1, 1892 => 8.4139235173, 1609 => 250.0, 1326 => 16.570008285, 1751 => 0.0414512742, 1468 => 9.95, 1185 => 35.0, 1327 => 0.0, 1893 => 10.5, 1610 => 95.0, 1469 => 0.240390482, 1752 => 0.0920149773, 1186 => 7.0, 1328 => 0.0, 1894 => 6.5821882847, 1611 => 42.5, 1753 => 0.0069782021, 1470 => 17.25, 1187 => 350.0, 1046 => 13.1873289279, 1612 => 25.0, 1329 => 3.8442419221, 1754 => 0.0058853958, 1471 => 18.19, 1188 => 262.5, 1330 => 1.1018913972, 1047 => 9.225, 1896 => 1.5, 1613 => 15.0, 1189 => 210.0, 1755 => 0.0236717607, 1897 => 3.8196835315, 1614 => 7.95, 1048 => 0.35, 1756 => 0.1214762135, 1190 => 12.0, 1898 => 61.1145939317, 1615 => 2.48307995, 1332 => 7.5, 1757 => 0.0586312858, 1474 => 147.5, 1191 => 0.021, 1616 => 5.2759592887, 1333 => 22000.0, 1050 => 12.5, 1899 => 13.82, 1758 => 2.7320157994, 1475 => 362.5, 1192 => 2.0, 1051 => 0.793166565, 1617 => 52.5, 1334 => 2.89, 1759 => 0.007851762, 1476 => 9.024829, 1052 => 0.003078287, 1618 => 27.5, 1335 => 6.65, 1760 => 0.0063649973, 1477 => 2.7186554714, 1194 => 8.0, 1619 => 0.25, 1336 => 14.7229498955, 1053 => 52.5, 1902 => 11.7286551631, 1195 => 0.0, 1761 => 0.0080504541, 1478 => 27.67, 1337 => 0.0855474907, 1620 => 0.0945, 1054 => 14.2117920311, 1196 => 0.0, 1762 => 0.0033948936, 1479 => 134.9893288662, 1338 => 0.7687614399, 1621 => 0.0525, 1055 => 21.4076989747, 1904 => 25.5, 1763 => 0.096, 1480 => 13.54, 1197 => 0.015, 1622 => 0.0525, 1056 => 11.1788262781, 1905 => 0.6371848761, 1764 => 0.1011, 1481 => 840.0, 1198 => 0.058, 1623 => 1.05, 1340 => 6.98, 1906 => 16.38, 1765 => 0.25, 1482 => 0.180169, 1199 => 0.0305, 1624 => 0.825, 1341 => 0.575, 1058 => 12.025, 1907 => 0.087, 1766 => 1.86, 1483 => 17.967763, 1200 => 0.049, 1059 => 0.0, 1625 => 0.8961696967, 1342 => 3.6387738194, 1908 => 0.07875, 1767 => 14.7306181036, 1484 => 8.6300867736, 1201 => 0.085, 1626 => 9.11, 1343 => 7.3, 1060 => 46.75, 1909 => 0.625, 1202 => 101.0, 1485 => 3.0506406345, 1768 => 12.6580543937, 1627 => 0.4457896125, 1344 => 1.4647887324, 1061 => 29.25, 1910 => 0.2, 1203 => 0.2857142857, 1486 => 53.7698392307, 1769 => 0.15005, 1628 => 4.4578961252, 1345 => 43.9436619718, 1062 => 3.9916549336, 1911 => 0.4881658325, 1487 => 237.5, 1204 => 0.192, 1770 => 0.20005, 1629 => 33.0, 1346 => 0.6008721896, 1063 => 14.5, 1912 => 0.4225118102, 1488 => 101.0, 1205 => 5150.0, 1771 => 0.0355932842, 1347 => 0.2135448444, 1630 => 487.5, 1064 => 5.5, 1913 => 5.6181892302, 1489 => 4.0425269519, 1206 => 62.5, 1772 => 0.0400981128, 1631 => 4.4, 1348 => 0.9, 1065 => 0.03, 1914 => 5.25, 1490 => 809.94, 1773 => 2.34, 1207 => 55.0, 1632 => 1.9502653224, 1349 => 1025.0, 1066 => 56.1131125979, 1491 => 50.75, 1208 => 1700.0, 1774 => 32.5, 1633 => 1.855, 1067 => 0.3937565954, 1916 => 2.075, 1492 => 1.5995872033, 1209 => 255.0, 1775 => 18.5, 1351 => 0.0331299573, 1634 => 1.41, 1068 => 11.5, 1917 => 0.5505, 1493 => 7.5311141486, 1210 => 87.5, 1776 => 0.42, 1352 => 241.615062462, 1635 => 0.075, 1069 => 7.8, 1918 => 2.9461236207, 1494 => 7.51, 1211 => 0.0136857719, 1777 => 0.34, 1636 => 150.0, 1353 => 3.15, 1070 => 300.0, 1919 => 14.7306181036, 1212 => 5.0, 1778 => 0.3, 1637 => 150.0, 1354 => 0.0420873018, 1071 => 30.0, 1496 => 0.375, 1213 => 840.0, 1779 => 0.0249050218, 1355 => 0.0, 1072 => 0.1975308642, 1921 => 2.1246347321, 1638 => 115.5, 1497 => 0.4030875, 1214 => 467.5, 1780 => 0.0340859651, 1356 => 292.5, 1073 => 4.735, 1639 => 0.35, 1215 => 3.4, 1498 => 39.625, 1781 => 3.3, 1357 => 2.2760517833, 1074 => 19.875, 1923 => 142.502071251, 1640 => 0.325, 1499 => 9.025, 1216 => 115.0, 1782 => 0.0528246817, 1075 => 1.31, 1358 => 1.5436317483, 1924 => 40.0086, 1641 => 38.025, 1500 => 50.0, 1217 => 3450.0, 1783 => 0.0514886489, 1359 => 0.0369394439, 1076 => 0.4668015, 1925 => 59.652029826, 1642 => 999.0, 1501 => 4.4709138807, 1218 => 24.0, 1784 => 0.0819433454, 1360 => 0.0440512508, 1077 => 0.007, 1926 => 14.75, 1643 => 290.0, 1502 => 18.34, 1219 => 6.125, 1785 => 0.0285362904, 1078 => 0.0, 1361 => 1.5, 1927 => 15.0, 1644 => 1.2, 1220 => 0.0, 1503 => 0.556886, 1786 => 1.6768924562, 1362 => 0.0058, 1079 => 6.0, 1928 => 7.0557947854, 1645 => 0.6, 1221 => 0.0, 1787 => 2.8776091179, 1363 => 0.28, 1080 => 39.9096978853, 1929 => 47.38, 1646 => 3.135, 1505 => 12.0, 1222 => 0.0038, 1788 => 0.0255816126, 1364 => 35.0, 1081 => 74.48, 1930 => 0.4528637349, 1647 => 1.185, 1223 => 0.00266, 1789 => 0.0162709903, 1506 => 3.1, 1648 => 20.8480793167, 1365 => 40.5, 1082 => 1.0, 1931 => 0.3643943832, 1507 => 188.5224098949, 1224 => 15.0903192433, 1790 => 0.0378557824, 1083 => 3.73, 1366 => 0.002031455, 1932 => 6.6113069484, 1649 => 1.457731, 1508 => 29.8438173558, 1225 => 50.5, 1791 => 0.0321508806, 1367 => 4.1, 1084 => 5.4, 1933 => 2.3308633855, 1650 => 0.1482183, 1226 => 21.25, 1792 => 0.9848788492, 1509 => 42.0, 1368 => 3.1770483969, 1085 => 15.0, 1934 => 0.0340517079, 1651 => 2.675, 1227 => 80.5, 1793 => 0.9335101008, 1510 => 19.5, 1369 => 0.05495, 1086 => 308.0, 1935 => 0.0255559095, 1652 => 0.955, 1794 => 1.0372178157, 1228 => 80.0, 1511 => 2.9118987813, 1370 => 122.5, 1087 => 24.5, 1936 => 0.0674011421, 1653 => 27.25, 1795 => 0.567419158, 1229 => 0.275, 1512 => 84.0, 1371 => 0.02025, 1088 => 2.0, 1937 => 1.95, 1654 => 18.75, 1796 => 0.0, 1230 => 5.0, 1513 => 80.0, 1372 => 55.0, 1089 => 23.5, 1938 => 0.0582373274, 1655 => 430.0, 1231 => 0.2818791946, 1797 => 1.212616, 1514 => 97.5, 1373 => 0.155, 1090 => 1250.0, 1939 => 0.0034257251, 1656 => 1175.0, 1232 => 0.028, 1798 => 0.0044191854, 1515 => 47.5, 1940 => 0.0674011421, 1374 => 16.25, 1091 => 62.5, 1657 => 155.0, 1233 => 0.028, 1799 => 0.0033572106, 1516 => 34.5, 1092 => 17.5, 1658 => 85.0, 1375 => 16.0, 1234 => 35.0, 1800 => 0.1356587156, 1517 => 77.0, 1093 => 0.0, 1376 => 3.355704698, 1942 => 0.0241856195, 1659 => 445.0, 1235 => 2.02118e-05, 1801 => 0.22995, 1518 => 74.505, 1094 => 0.3, 1943 => 0.0189785173, 1660 => 3.25, 1377 => 391.0, 1236 => 1.41482e-05, 1802 => 0.04, 1519 => 70.3873467416, 1095 => 0.1832, 1661 => 1.025, 1378 => 16.0, 1237 => 10.6, 1803 => 0.0575, 1520 => 885.0, 1096 => 0.4968329171, 1662 => 0.52, 1379 => 305.0, 1521 => 0.3782794387, 1238 => 485.0, 1804 => 0.00575, 1097 => 0.1025, 1946 => 2.1051080988, 1380 => 22.0, 1522 => 0.956733699, 1239 => 2.775, 1805 => 0.0078, 1381 => 0.2892069171, 1098 => 90.0, 1947 => 4.2102161975, 1664 => 4.925, 1240 => 1.2, 1806 => 0.0012, 1523 => 290.0, 1382 => 0.0, 1099 => 3287.0, 1948 => 1.5662415342, 1665 => 250.05, 1241 => 0.25875, 1807 => 0.0008, 1100 => 915.0, 1666 => 135.0, 1383 => 1.125, 1525 => 0.0053833547, 1808 => 1.4814814815, 1242 => 0.0835, 1101 => 34.75, 1950 => 123.5, 1667 => 45.0, 1384 => 9.0, 1243 => 0.38, 1809 => 200.5, 1526 => 16.5749519326, 1102 => 7.55, 1951 => 18.72, 1668 => 7.05, 1385 => 165.5, 1244 => 375.0, 1810 => 2.0, 1527 => 119.2921996156, 1103 => 3.5, 1952 => 1.3913582658, 1386 => 0.0825, 1245 => 262.5, 1811 => 0.25, 1104 => 110.0, 1953 => 3.5, 1670 => 17.5, 1387 => 0.07995, 1812 => 0.0425, 1529 => 1.19416475, 1246 => 13.0, 1105 => 5.5, 1954 => 4.55, 1388 => 138.5, 1813 => 0.03025, 1530 => 10.4, 1247 => 15.0, 1106 => 72.5, 1955 => 63.0, 1672 => 26.3266977037, 1389 => 20.0, 1814 => 0.425, 1531 => 6.5, 1248 => 5.9957041407, 1673 => 0.69, 1107 => 60.5, 1956 => 82.5, 1390 => 50.0, 1815 => 0.0085, 1532 => 16.75, 1249 => 45.5, 1108 => 32.5, 1957 => 349.5, 1674 => 0.004, 1391 => 23.2, 1816 => 0.0036312686, 1533 => 8.2, 1250 => 38.0, 1109 => 85.0, 1958 => 150.0, 1675 => 0.0007568834, 1392 => 29.0, 1251 => 0.0, 1817 => 0.3, 1534 => 155.0, 1110 => 0.0, 1393 => 42.0, 1959 => 0.3275, 1676 => 0.0173341692, 1252 => 0.0, 1818 => 0.0391389097, 1535 => 1.0108, 1111 => 45.4564344991, 1677 => 0.952351589, 1394 => 225.0, 1819 => 0.0199891062, 1536 => 250.0, 1253 => 400.0, 1395 => 0.0298705178, 1112 => 5.1860890787, 1961 => 8.75, 1678 => 0.6508877767, 1254 => 280.0, 1820 => 0.0033914679, 1537 => 10.861594, 1962 => 19.0, 1679 => 8.75, 1396 => 16.13, 1113 => 64.0, 1821 => 0.0021924641, 1538 => 0.360338, 1255 => 750.0, 1114 => 0.0305064063, 1963 => 550.0, 1680 => 7.5, 1822 => 0.35, 1256 => 350.0, 1964 => 0.76, 1681 => 0.7, 1398 => 10.3726, 1115 => 101.0, 1257 => 0.017, 1823 => 0.000486453, 1540 => 7.31731825, 1116 => 0.3324549954, 1682 => 0.162501596, 1399 => 0.0421741865, 1965 => 59.0, 1824 => 1.353504003, 1258 => 0.055, 1117 => 25.0, 1683 => 0.0203145501, 1400 => 6.0, 1966 => 580.0, 1825 => 0.0004727501, 1259 => 0.0375, 1684 => 1.2092739475, 1118 => 2450.0, 1967 => 660.0, 1826 => 0.0019252575, 1543 => 17.3, 1260 => 0.45, 1685 => 12.0927394753, 1402 => 0.621, 1119 => 1.5, 1968 => 1.35, 1261 => 5.0, 1827 => 0.0001096232, 1544 => 6.1882298936, 1686 => 0.0053441312, 1403 => 0.05, 1120 => 0.4, 1969 => 0.1565, 1828 => 0.000236375, 1545 => 24.84, 1262 => 1.075, 1687 => 0.0021924641, 1404 => 1.7, 1121 => 28.5, 1970 => 2.4, 1829 => 2.3637503469, 1546 => 20.25, 1263 => 1.025, 1688 => 0.7626601586, 1122 => 15.0, 1971 => 0.64375, 1830 => 0.0002089692, 1547 => 9.0, 1264 => 4.2875, 1689 => 0.9768151312, 1123 => 25.75, 1972 => 130.0, 1831 => 0.0003288696, 1548 => 0.116, 1265 => 2.775, 1124 => 32.0, 1690 => 1.0372178157, 1973 => 85.0, 1549 => 0.05, 1832 => 0.0002089692, 1266 => 90.0, 1691 => 0.0051043305, 1125 => 875.0, 1974 => 90.5, 1833 => 0.0003871069, 1550 => 17.7313283, 1267 => 62.5, 1692 => 0.0092494579, 1409 => 3.235, 1126 => 0.2809094615, 1975 => 0.1625, 1551 => 0.0017241379, 1268 => 85.0, 1834 => 0.0003459982, 1410 => 0.0147651007, 1693 => 25.25, 1127 => 26.8, 1976 => 87.5, 1269 => 0.0, 1835 => 0.0447399703, 1411 => 6000.0, 1694 => 15.175, 1128 => 75.0, 1977 => 61.25, 1553 => 3.16, 1270 => 81.0, 1836 => 4.4739970333, 1695 => 0.0005823733, 1412 => 0.76755, 1129 => 32.5, 1978 => 950.0, 1554 => 4.618878, 1271 => 3.0, 1837 => 0.00113, 1696 => 94.2822384428, 1413 => 0.0, 1130 => 153.5, 1979 => 279.0, 1272 => 2.5, 1838 => 0.0001164747, 1414 => 0.0, 1697 => 36.667141, 1131 => 0.0})
@@ -91,7 +91,8 @@ describe "Wherever" do
91
91
  it 'add the change' do
92
92
  wherever.add({"settled" => 110, "unsettled" => 0}, options_second)
93
93
 
94
- wherever.get_key_store("unique").datasets.all.should ==
94
+ data = wherever.get_key_store("unique").datasets.all.to_a.sort_by(&:sorter)
95
+ data.should ==
95
96
  [DbStore::Dataset.new("fund_id" => 2, "trade_id" => 12, "version" => 1, "values" => {"unsettled" => 0, "settled" => 100}),
96
97
  DbStore::Dataset.new("fund_id" => 2, "trade_id" => 12, "version" => 2, "values" => {"unsettled" => 0, "settled" => 10})]
97
98
  end
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe Wherever, 'run file test' do
4
+ let(:wherever) do
5
+ Wherever.new("keys" => keys, "database" => 'wherever_test',
6
+ "key_groups" => key_groups, "key" => "trade_id") do |values, data, record, keys|
7
+ price = wherever.get_price('current', record)
8
+ if keys.include?("technical_instrument")
9
+ values["position"] ||= 0
10
+ values["position"] += data["position"] if data
11
+ values["price"] = price
12
+ end
13
+ if data
14
+ values["trade_value"] ||= 0
15
+ values["trade_value"] += data["position"] * price
16
+ else
17
+ debugger unless values["position"]
18
+ debugger unless price
19
+ values["trade_value"] = values["position"] * price
20
+ end
21
+ end
22
+ end
23
+ let(:keys) { ["fund", "technical_instrument"] }
24
+ # let(:key_groups) { [["fund"], ["fund", "technical_instrument"]] }
25
+ let(:key_groups) { [["fund"]] }
26
+ before do
27
+ wherever.create_lookup('price', ["technical_instrument"])
28
+ end
29
+
30
+ it 'processes a script file' do
31
+ file = File.expand_path(File.dirname(__FILE__) + '/../data/test_file_1.script')
32
+ File.open(file) do |f|
33
+ while !f.eof do
34
+ eval(f.readline)
35
+ end
36
+ end
37
+
38
+ data = wherever.get_key_store('fund').datasets.all.to_a.sort_by(&:fund_id)
39
+ data.should == [
40
+ DbStore::Dataset.new("values" => {"trade_value" => 1078574.78347554}, "fund_id" => 2),
41
+ DbStore::Dataset.new("values" => {"trade_value" => 10110445.4601847}, "fund_id" => 3),
42
+ DbStore::Dataset.new("values" => {"trade_value" => 3882339.86299649}, "fund_id" => 4),
43
+ DbStore::Dataset.new("values" => {"trade_value" => 37136876.9682663}, "fund_id" => 5),
44
+ DbStore::Dataset.new("values" => {"trade_value" => 12371476.6074616}, "fund_id" => 6),
45
+ DbStore::Dataset.new("values" => {"trade_value" => 12928015.20472}, "fund_id" => 7),
46
+ DbStore::Dataset.new("values" => {"trade_value" => 5529137.63911313}, "fund_id" => 8),
47
+ DbStore::Dataset.new("values" => {"trade_value" => 961021.11258642}, "fund_id" => 9),
48
+ DbStore::Dataset.new("values" => {"trade_value" => 7433216.25251049}, "fund_id" => 10),
49
+ DbStore::Dataset.new("values" => {"trade_value" => 939194.3717994}, "fund_id" => 11)
50
+ ]
51
+ end
52
+ end
@@ -93,7 +93,7 @@ describe Wherever, 'using lookup in grouping calculation' do
93
93
  it 'on fund record with two trades' do
94
94
  wherever.add({"position" => 200}, options_three)
95
95
  wherever.set_price('current', {4 => 12.5})
96
- wherever.get_key_store("fund").datasets.all.should ==
96
+ wherever.get_key_store("fund").datasets.all.to_a.should ==
97
97
  [DbStore::Dataset.new("values" => {"trade_value" => 3750}, "fund_id" => 2)]
98
98
  end
99
99
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wherever-positions}
8
- s.version = "0.4.7"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Henry"]
12
- s.date = %q{2011-11-07}
12
+ s.date = %q{2011-11-08}
13
13
  s.description = %q{Allow Store of positions by multiple keys with teh option to mark specific points in time for use later}
14
14
  s.email = %q{dw_henry@yahoo.com.au}
15
15
  s.extra_rdoc_files = [
@@ -45,10 +45,12 @@ Gem::Specification.new do |s|
45
45
  "lib/wherever/wherever/getter.rb",
46
46
  "lib/wherever/wherever/lookup.rb",
47
47
  "lib/wherever/wherever/mark.rb",
48
+ "spec/data/test_file_1.script",
48
49
  "spec/method_logging_spec.rb",
49
50
  "spec/spec_helper.rb",
50
51
  "spec/wherever/adder_spec.rb",
51
52
  "spec/wherever/custom_grouping_spec.rb",
53
+ "spec/wherever/full_run_spec.rb",
52
54
  "spec/wherever/getter_spec.rb",
53
55
  "spec/wherever/key_store_spec.rb",
54
56
  "spec/wherever/mark_spec.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wherever-positions
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 7
10
- version: 0.4.7
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Henry
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-07 00:00:00 +00:00
18
+ date: 2011-11-08 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -202,10 +202,12 @@ files:
202
202
  - lib/wherever/wherever/getter.rb
203
203
  - lib/wherever/wherever/lookup.rb
204
204
  - lib/wherever/wherever/mark.rb
205
+ - spec/data/test_file_1.script
205
206
  - spec/method_logging_spec.rb
206
207
  - spec/spec_helper.rb
207
208
  - spec/wherever/adder_spec.rb
208
209
  - spec/wherever/custom_grouping_spec.rb
210
+ - spec/wherever/full_run_spec.rb
209
211
  - spec/wherever/getter_spec.rb
210
212
  - spec/wherever/key_store_spec.rb
211
213
  - spec/wherever/mark_spec.rb