dukascript 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dukascript/__init__.py CHANGED
@@ -341,6 +341,8 @@ def live_fetch(
341
341
  logger=logger,
342
342
  )
343
343
 
344
+ yield df
345
+
344
346
  for row in datafeed:
345
347
 
346
348
  timestamp = _resample_to_nearest(
@@ -0,0 +1,224 @@
1
+ Metadata-Version: 2.4
2
+ Name: dukascript
3
+ Version: 0.0.4
4
+ Summary: Download tick data from Dukascopy Bank SA to local cache, and simulate time-ordered price streams
5
+ Author-email: Eghosa Osayande <osayandeeghosam@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 drui9
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/Eghosa-Osayande/dukascript
28
+ Keywords: tick-data,forex-data,tick-api,ticks,dukascopy
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Programming Language :: Python
31
+ Classifier: Programming Language :: Python :: 3
32
+ Requires-Python: >=3.10
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Requires-Dist: pandas
36
+ Requires-Dist: requests
37
+ Provides-Extra: dev
38
+ Requires-Dist: build; extra == "dev"
39
+ Requires-Dist: twine; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # 🏦 dukascript
43
+
44
+ Download and stream historical price data for variety of financial instruments (e.g. Forex, Commodities and Indices) from Dukascopy Bank SA. , including support for tick-level and aggregated intervals.
45
+
46
+ ---
47
+
48
+ ## 📦 Installation
49
+
50
+ ```bash
51
+ pip install dukascript
52
+ ```
53
+
54
+ ---
55
+
56
+ ## 🛠️ Usage
57
+
58
+ ### Importing
59
+
60
+ ```python
61
+ from datetime import datetime, timedelta
62
+ import dukascript
63
+ from dukascript.instruments import INSTRUMENT_FX_MAJORS_GBP_USD
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 🧠 Key Concepts
69
+
70
+ Both `fetch` and `live_fetch` share similar parameters:
71
+
72
+ | Parameter | Description |
73
+ |----------------|-----------------------------------------------------------------------------|
74
+ | `start` | `datetime`, required. The start time of the data. |
75
+ | `end` | `datetime`, optional. If `None`, fetches data up to "now". |
76
+ | `instrument` | e.g., `INSTRUMENT_FX_MAJORS_GBP_USD`. |
77
+ | `offer_side` | `OFFER_SIDE_BID` or `OFFER_SIDE_ASK`. |
78
+ | `max_retries` | Optional. If `None`, keeps retrying on failure. |
79
+ | `debug` | Optional. If `True`, prints debug logs. |
80
+
81
+ ### 🧊 `fetch()` only:
82
+
83
+ | Parameter | Description |
84
+ |--------------|------------------------------|
85
+ | `interval` | e.g., `INTERVAL_HOUR_1` |
86
+
87
+ ### 🔥 `live_fetch()` only:
88
+
89
+ | Parameter | Description |
90
+ |-------------------|---------------------------------------------|
91
+ | `interval_value` | e.g., `1` |
92
+ | `time_unit` | e.g., `dukascript.TIME_UNIT_HOUR` |
93
+
94
+ ---
95
+
96
+ ## 📝 Notes
97
+
98
+ - **fetch**: Fetches static historical data. Returns **one** `DataFrame`.
99
+ - **live_fetch**: Continuously fetches live updates. Returns a **generator** that yields the **same `DataFrame`** with updated data.
100
+
101
+ When using intervals like `1HOUR`, `fetch()` may return delayed data due to DukasCopy’s aggregation policy. For up-to-date values, use `live_fetch()` which fetches tick data under the hood and reshapes it live.
102
+
103
+ ---
104
+
105
+ ## 📊 DataFrame Format
106
+
107
+ ### For tick data:
108
+
109
+ | Column | Description |
110
+ |-------------|------------------------|
111
+ | `timestamp` | Index (UTC) |
112
+ | `bidPrice` | Bid price |
113
+ | `askPrice` | Ask price |
114
+ | `bidVolume` | Bid volume |
115
+ | `askVolume` | Ask volume |
116
+
117
+ ### For aggregated intervals:
118
+
119
+ | Column | Description |
120
+ |-------------|------------------------|
121
+ | `timestamp` | Index |
122
+ | `open` | Opening price |
123
+ | `high` | Highest price |
124
+ | `low` | Lowest price |
125
+ | `close` | Closing price |
126
+ | `volume` | Volume (in units) |
127
+
128
+ ---
129
+
130
+ ## 💾 Saving Results
131
+
132
+ Use built-in `pandas` methods to export:
133
+
134
+ ```python
135
+ df.to_csv("data.csv")
136
+ df.to_excel("data.xlsx")
137
+ df.to_json("data.json")
138
+ ```
139
+
140
+ ---
141
+
142
+ ## 🚀 Examples
143
+
144
+ ### Example 1: Fetch Historical Data
145
+
146
+ ```python
147
+ start = datetime(2025, 1, 1)
148
+ end = datetime(2025, 2, 1)
149
+ instrument = INSTRUMENT_FX_MAJORS_GBP_USD
150
+ interval = dukascript.INTERVAL_HOUR_1
151
+ offer_side = dukascript.OFFER_SIDE_BID
152
+
153
+ df = dukascript.fetch(
154
+ instrument,
155
+ interval,
156
+ offer_side,
157
+ start,
158
+ end,
159
+ )
160
+
161
+ df.to_json("output.json")
162
+ ```
163
+
164
+ ---
165
+
166
+ ### Example 2: Live Fetch with End Time
167
+
168
+ ```python
169
+ now = datetime.now()
170
+ start = datetime(now.year, now.month, now.day)
171
+ end = start + timedelta(hours=24)
172
+
173
+ iterator = dukascript.live_fetch(
174
+ instrument,
175
+ 1,
176
+ dukascript.TIME_UNIT_HOUR,
177
+ offer_side,
178
+ start,
179
+ end,
180
+ )
181
+
182
+ for df in iterator:
183
+ pass
184
+
185
+ df.to_csv("output.csv")
186
+ ```
187
+
188
+ ---
189
+
190
+ ### Example 3: Live Fetch Indefinitely (End = None)
191
+
192
+ ```python
193
+ now = datetime.now()
194
+ start = datetime(now.year, now.month, now.day)
195
+ end = None
196
+
197
+ df_iterator = dukascript.live_fetch(
198
+ instrument,
199
+ 1,
200
+ dukascript.TIME_UNIT_HOUR,
201
+ offer_side,
202
+ start,
203
+ end,
204
+ )
205
+
206
+ for df in df_iterator:
207
+ # Do something with latest data
208
+ pass
209
+ ```
210
+
211
+ ---
212
+
213
+ ## 📄 License
214
+
215
+ MIT
216
+
217
+ ---
218
+
219
+ ## 👋 Contributing
220
+
221
+ Pull requests and suggestions welcome!
222
+ ```
223
+
224
+ ---
@@ -0,0 +1,8 @@
1
+ dukascript/__init__.py,sha256=bPsw_EhL1g35ulDZLWuIZO3ueHncS-7dQ5AFvyT84nw,11412
2
+ dukascript/_instrument_generator.py,sha256=WDTNS1bLa-J2uI3TmoBTg-WCHdAtkX6d6tq0xhqL4GI,24848
3
+ dukascript/instruments.py,sha256=OxKTWR8zx2sjaHtGtd81FsQwTdAMItjgUSojzuJ1waI,59069
4
+ dukascript-0.0.4.dist-info/licenses/LICENSE,sha256=SA8D35cWkNTiEI71ATLBPTzWgFwjPNZLeloeBJrAJr4,1061
5
+ dukascript-0.0.4.dist-info/METADATA,sha256=PacypFzc983Mj5v0dmBu0VN5efRwTfOJgMC40ON3d-E,6230
6
+ dukascript-0.0.4.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
7
+ dukascript-0.0.4.dist-info/top_level.txt,sha256=h7GgEQykn3TuhHU4jJxZQ7oNjP_naNvjUwZAw6KU3VE,11
8
+ dukascript-0.0.4.dist-info/RECORD,,
@@ -1,44 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: dukascript
3
- Version: 0.0.2
4
- Summary: Download tick data from Dukascopy Bank SA to local cache, and simulate time-ordered price streams
5
- Author-email: Eghosa Osayande <osayandeeghosam@gmail.com>
6
- License: MIT License
7
-
8
- Copyright (c) 2024 drui9
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
- Project-URL: Homepage, https://github.com/Eghosa-Osayande/dukascript
28
- Keywords: tick-data,forex-data,tick-api,ticks,dukascopy
29
- Classifier: License :: OSI Approved :: MIT License
30
- Classifier: Programming Language :: Python
31
- Classifier: Programming Language :: Python :: 3
32
- Requires-Python: >=3.10
33
- Description-Content-Type: text/markdown
34
- License-File: LICENSE
35
- Requires-Dist: pandas
36
- Requires-Dist: requests
37
- Provides-Extra: dev
38
- Requires-Dist: build; extra == "dev"
39
- Requires-Dist: twine; extra == "dev"
40
- Dynamic: license-file
41
-
42
- # dukascript
43
-
44
- Download and stream historical data from Dukascopy Bank SA.
@@ -1,8 +0,0 @@
1
- dukascript/__init__.py,sha256=uKpjTfC7lEw8LRPHdXbEw2jyviA4mUhW2CoKJw412nE,11398
2
- dukascript/_instrument_generator.py,sha256=WDTNS1bLa-J2uI3TmoBTg-WCHdAtkX6d6tq0xhqL4GI,24848
3
- dukascript/instruments.py,sha256=OxKTWR8zx2sjaHtGtd81FsQwTdAMItjgUSojzuJ1waI,59069
4
- dukascript-0.0.2.dist-info/licenses/LICENSE,sha256=SA8D35cWkNTiEI71ATLBPTzWgFwjPNZLeloeBJrAJr4,1061
5
- dukascript-0.0.2.dist-info/METADATA,sha256=4mb_CxQLSNqAhflL7miHQVJQEKumZ5a-yJ4LBEDLQw0,2040
6
- dukascript-0.0.2.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
7
- dukascript-0.0.2.dist-info/top_level.txt,sha256=h7GgEQykn3TuhHU4jJxZQ7oNjP_naNvjUwZAw6KU3VE,11
8
- dukascript-0.0.2.dist-info/RECORD,,