Showing
4 changed files
with
29 additions
and
43 deletions
| ... | @@ -237,8 +237,7 @@ class Simulator_Func: | ... | @@ -237,8 +237,7 @@ class Simulator_Func: |
| 237 | columns=['id', 'order_num', 'code', 'code_name', 'rate', 'purchase_rate', | 237 | columns=['id', 'order_num', 'code', 'code_name', 'rate', 'purchase_rate', |
| 238 | 'purchase_price','present_price', 'valuation_price','valuation_profit', | 238 | 'purchase_price','present_price', 'valuation_price','valuation_profit', |
| 239 | 'holding_amount', 'buy_date', 'item_total_purchase','chegyul_check', | 239 | 'holding_amount', 'buy_date', 'item_total_purchase','chegyul_check', |
| 240 | - 'invest_unit','sell_date', 'sell_price', 'sell_rate', 'rate_std', | 240 | + 'invest_unit','sell_date', 'sell_price', 'sell_rate', |
| 241 | - 'rate_std_mod_val','rate_std_htr', 'rate_htr','rate_std_mod_val_htr', | ||
| 242 | 'yes_close', 'close', 'd1_diff_rate', 'd1_diff', | 241 | 'yes_close', 'close', 'd1_diff_rate', 'd1_diff', |
| 243 | 'open', 'high','low','volume', | 242 | 'open', 'high','low','volume', |
| 244 | 'clo5', 'clo10', 'clo20', 'clo60','clo120', | 243 | 'clo5', 'clo10', 'clo20', 'clo60','clo120', |
| ... | @@ -1191,4 +1190,31 @@ class Simulator_Func: | ... | @@ -1191,4 +1190,31 @@ class Simulator_Func: |
| 1191 | # 매도 리스트가 존재하지 않는다면 매수만 진행 | 1190 | # 매도 리스트가 존재하지 않는다면 매수만 진행 |
| 1192 | else: | 1191 | else: |
| 1193 | if self.check_balance(): | 1192 | if self.check_balance(): |
| 1194 | - self.auto_trade_buy_stock(str(date_rows_today) + "0900", date_rows_today, date_rows_yesterday) | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1193 | + self.auto_trade_buy_stock(str(date_rows_today) + "0900", date_rows_today, date_rows_yesterday) | ||
| 1194 | + | ||
| 1195 | + # daily_buy_list 데이터베이스에서 가장 최근의 날짜 테이블을 가져오는 함수 | ||
| 1196 | + def get_recent_daily_buy_list_date(self): | ||
| 1197 | + query="select TABLE_NAME from information_schema.tables " \ | ||
| 1198 | + "where table_schema = 'daily_buy_list' and TABLE_NAME like '%s' order by table_name desc limit 1" | ||
| 1199 | + row = self.engine_daily_buy_list.execute(query % ("20%%")).fetchall() | ||
| 1200 | + | ||
| 1201 | + if len(row) == 0: | ||
| 1202 | + return False | ||
| 1203 | + return row[0][0] | ||
| 1204 | + | ||
| 1205 | + # 최근 daily_buy_list의 날짜 테이블에서 code에 해당하는 데이터만 가져오는 함수 | ||
| 1206 | + def get_daily_buy_list_by_code(self,code,date): | ||
| 1207 | + query = f"select * from `{date}` where code = '{code}' group by code" | ||
| 1208 | + | ||
| 1209 | + daily_buy_list = self.engine_daily_buy_list.execute(query).fetchall() | ||
| 1210 | + | ||
| 1211 | + df_daily_buy_list = DataFrame(daily_buy_list, | ||
| 1212 | + columns=['index', 'index2', 'date', 'check_item', | ||
| 1213 | + 'code', 'code_name', 'd1_diff', 'd1_diff_rate', | ||
| 1214 | + 'close', 'open','high', 'low', 'volume', | ||
| 1215 | + 'clo5', 'clo10', 'clo20', 'clo60', 'clo120', | ||
| 1216 | + "clo5_diff_rate", "clo10_diff_rate", "clo20_diff_rate", | ||
| 1217 | + "clo60_diff_rate", "clo120_diff_rate", | ||
| 1218 | + 'yes_clo5', 'yes_clo10', 'yes_clo20', 'yes_clo60','yes_clo120', | ||
| 1219 | + 'vol5', 'vol10', 'vol20', 'vol60', 'vol120']) | ||
| 1220 | + return df_daily_buy_list | ... | ... |
This diff is collapsed. Click to expand it.
proj/library/collector_api_pre.py
deleted
100644 → 0
| 1 | -from sqlalchemy import * | ||
| 2 | - | ||
| 3 | -from open_api import * | ||
| 4 | -from daily_info import * | ||
| 5 | -from stock_info import * | ||
| 6 | -import config | ||
| 7 | - | ||
| 8 | -class CollectorApi(): | ||
| 9 | - def __init__(self): | ||
| 10 | - self.open_api=OpenApi() | ||
| 11 | - self.engine_bot=self.open_api.engine_bot | ||
| 12 | - | ||
| 13 | - def set_variable(self): | ||
| 14 | - self.open_api.sort="collector" | ||
| 15 | - self.stock_info=StockInfo(config.real_bot,config.real_stockInfo,config.real_dailyInofo) | ||
| 16 | - self.daily_info=DailyInfo() | ||
| 17 | - | ||
| 18 | - def update_code(self): | ||
| 19 | - print("update code") | ||
| 20 | - query = "select code_update,jango_data_db_check, possessed_item, today_profit, final_chegyul_check, " \ | ||
| 21 | - "db_to_buy_list,today_buy_list, daily_crawler , min_crawler, daily_buy_list " \ | ||
| 22 | - "from setting_data limit 1" | ||
| 23 | - result=self.engine_bot.execute(query).fetchall() | ||
| 24 | - | ||
| 25 | - print(result) | ||
| 26 | - | ||
| 27 | - if result[0][0]!=self.open_api.today(): | ||
| 28 | - self.open_api.check_balance() | ||
| 29 | - self.get_code_list() | ||
| 30 | - | ||
| 31 | - | ||
| 32 | - def set_db_minute_info(self): | ||
| 33 | - print("Make Minute Info Database") | ||
| 34 | - query="select code,code_name from stock_all" | ||
| 35 | - target=self.open_api.engine_dInfo.execute(query).fetchall() | ||
| 36 | - print(target) | ||
| 37 | - | ||
| 38 | -app = QApplication(sys.argv) | ||
| 39 | -c=CollectorApi() | ||
| 40 | -c.update_code() | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment