Skip to content

Commit

Permalink
Add TORA channel.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jedore committed Jul 19, 2024
1 parent 7cab6c7 commit d03503a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@
| 6.7.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.7.2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |

- [x] 华鑫证券奇点TORA

[详情跳转](https://github.com/openctp/openctp/tree/master/ctp2STP)

| version | win x86 | win x64 | linux x64 |
|---------|--------------------|--------------------|--------------------|
| 6.3.15 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.3.19 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.5.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.9 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |

- [x] 东方财富EMT(emt)

[详情跳转](https://github.com/openctp/openctp/tree/master/ctp2EMT)
Expand All @@ -73,6 +86,14 @@
| 6.6.1 | :heavy_check_mark: | :x: |
| 6.6.7 | :heavy_check_mark: | :x: |

- [x] 中泰证券XTP(xtp)

[详情跳转](https://github.com/openctp/openctp/tree/master/ctp2XTP)

| version | win x86 | win x64 | linux x64 |
|---------|---------|--------------------|-----------|
| 6.6.1 | :x: | :heavy_check_mark: | :x: |

- [x] 新浪财经(sina)
只能查询行情,不可以交易,[详情跳转](https://github.com/openctp/openctp/blob/master/ctp2Sina/readme.md)

Expand All @@ -95,15 +116,6 @@
| 6.6.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| 6.6.7 | :x: | :heavy_check_mark: | :x: |

- [x] 中泰XTP(xtp)

[详情跳转](https://github.com/openctp/openctp/tree/master/ctp2XTP)

| version | win x86 | win x64 | linux x64 |
|---------|---------|--------------------|-----------|
| 6.6.1 | :x: | :heavy_check_mark: | :x: |

- [ ] 华鑫TORA
- [ ] 易盛
- [ ] 易达
- [ ] 东方证券OST
Expand Down
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Add `--version` option
- Add emt channel.
- Add xtp channel.
- Add tora channel.

## 0.1.1

Expand Down
24 changes: 23 additions & 1 deletion src/openctp_ctp_channels/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
'qq': '腾讯财经',
'sina': '新浪财经',
'emt': '东方财富EMT',
'xtp': '中泰XTP',
'xtp': '中泰证券XTP',
'tora': '华鑫证券奇点TORA',
}

BASE_DIR = Path(__file__).parent
Expand Down Expand Up @@ -410,6 +411,27 @@ def _copy_libs(self):
self._copy_files(['xtpquoteapi.dll', 'xtptraderapi.dll'])


class ToraChannel(Channel):

def __init__(self):
super().__init__('tora')

def switch(self):
if self.current_channel() == self._channel:
print('Current channel is', self._channel)
return

print(f'Switch to {self._channel} channel.')

self._download()
self._backup()
self._copy_libs()

def _copy_libs(self):
super()._copy_libs()
self._copy_files(['fasttraderapi.dll', 'xfastmdapi.dll'])


if __name__ == '__main__':
# c = TTSChannel()
# c.switch()
Expand Down
2 changes: 2 additions & 0 deletions src/openctp_ctp_channels/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def switch(channel):
channel = channels.EMTChannel()
elif 'xtp' == channel:
channel = channels.XTPChannel()
elif 'tora' == channel:
channel = channels.ToraChannel()
else:
print("Unsupported channel!")
return
Expand Down

0 comments on commit d03503a

Please sign in to comment.