forked from rtstock/rts
/
checklistener.py
96 lines (85 loc) · 4.26 KB
/
checklistener.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 6 12:17:33 2014
@author: jmalinchak
"""
#class inheritedclass(initialclass):
# def __new__(self):
# self.attr3 = 'three'
# super(initialclass, self).__init__()
class check:
def __new__(self):
self.attr3 = 'three'
c = self.execute_checklistener()
super(c, self).__init__()
def __init__(self):
self.execute_checklistener()
def execute_checklistener(self):
import os
import shutil
SymbolsFile = ''
ExpirationsFile = ''
ListenerFileFound = 0
#RootRemoteListener="Z:\\jm\\My Python\\Remote\\listener"
RootRemote = os.path.join('z:','\jm','My Python','Remote')
if os.path.isfile(os.path.join(RootRemote,'listener','short.txt')):
if os.path.isfile(os.path.join(RootRemote,'inputs','SymbolsShort.txt')):
destSymbols = os.getcwd() + '\\inputs\\SymbolsShort.txt'
shutil.copyfile('Z:\\jm\\My Python\\Remote\\Inputs\\SymbolsShort.txt', destSymbols)
if os.path.isfile('Z:\\jm\\My Python\\Remote\\Inputs\\ExpirationsShort.txt'):
destExpirations = os.getcwd() + '\\inputs\\ExpirationsShort.txt'
shutil.copyfile('Z:\\jm\\My Python\\Remote\\Inputs\\ExpirationsShort.txt', destExpirations)
os.remove("Z:\\jm\\My Python\\Remote\\listener\\short.txt")
SymbolsFile = 'inputs\\SymbolsShort.txt'
ExpirationsFile = 'inputs\\ExpirationsShort.txt'
ListenerFileFound = 1
if os.path.isfile("Z:\\jm\\My Python\\Remote\\listener\\main.txt"):
if os.path.isfile('Z:\\jm\\My Python\\Remote\\Inputs\\SymbolsMain.txt'):
shutil.copyfile('Z:\\jm\\My Python\\Remote\\Inputs\\SymbolsMain.txt', 'inputs\\SymbolsMain.txt')
if os.path.isfile('Z:\\jm\\My Python\\Remote\\Inputs\\ExpirationsMain.txt'):
shutil.copyfile('Z:\\jm\\My Python\\Remote\\Inputs\\ExpirationsMain.txt', 'inputs\\ExpirationsMain.txt')
os.remove("Z:\\jm\\My Python\\Remote\\listener\\main.txt")
SymbolsFile = 'inputs\\SymbolsMain.txt'
ExpirationsFile = 'inputs\\ExpirationsMain.txt'
ListenerFileFound = 1
if os.path.isfile("Z:\\jm\\My Python\\Remote\\listener\\run.txt"):
os.remove("Z:\\jm\\My Python\\Remote\\listener\\run.txt")
SymbolsFile = 'inputs\\Symbols.txt'
ExpirationsFile = 'inputs\\Expirations.txt'
ListenerFileFound = 1
if ListenerFileFound == 0:
print('no short/main/run file found')
if ListenerFileFound > 0:
print('listener file found...')
import mytools
datetime14 = mytools.mystrings.ConvertDatetime14()
print(datetime14)
#outputfilepath = 'C:\\Documents and Settings\\jmalinchak\\My Documents\\My Python\\Active\\output\\' + datetime14 + '.csv'
import pulloptionscsvbasedoninputfiles
pulloptionscsvbasedoninputfiles.pull(SymbolsFile,
ExpirationsFile,
'downloads',
'output',
0)
# import strategytestnew
# c = strategytestnew.calendarspreads(SymbolsFile,
# ExpirationsFile,
# 'downloads',
# 'output',
# 0)
#
# outputfilepath = c.OutputFilePathString
# print('The process create local output file: ' + outputfilepath)
# head, tail = os.path.split(outputfilepath)
# print('The file name only: ' + tail)
# shutil.copyfile(outputfilepath, os.path.join(RootRemote,'output',tail))
# return c
#########################
#
return None
#
#########################
c = check
o = c.execute_checklistener(c)
if not o is None:
print('The OutputFilePathString that was inherited is at: ' + o.OutputFilePathString)