Python(12)
-
파이썬 예시 / 자동매매 / 변동성 돌파전력 + 특정시간 매매
안녕하세요 COLAB을 통해 비트코인 매매에 대한 거래금액 경향을 파악해 보면 최근 200시간의 경향이 아래와 같습니다. 이때, 00-03시, 14-17시 에는 매매가가 오르는 경향이 있고, 이를 자동매매 코드에 같이 적용해보겠습니다. 변동성 돌파전략과 함께, 특정 매매 시간을 적용하면, 상승장에는 변동성 돌파전략으로 매수를 하고, 하락장에는 변동성 돌파전략으로는 매수가 일어나지 않으니, 특정시간 매매 기능을 통해, 하락장에서도 매수를 통한 차익을 기대해 볼 수 있겠습니다 (물론 투자와 관련한 책임과 판단은 본인에게 있습니다 ^^;, 저는 코드만 공유합니다) 아래 코드를 참고해 주세요. 파이썬 SCHEDULE 기능을 구현해 보았습니다. (업비트 기준입니다) import schedule import tim..
2022.01.12 -
파이썬 퍼센트 구하기
############################################### # 전체값에서 일부값은 몇 퍼센트? 계산 # 공식은 "일부값 나누기 전체값 곱하기 100.0" ############################################### # 10은 100에서 몇 퍼센트? print "%.2f%%" % (10.0 / 100.0 * 100.0) # 출력 결과: 10.00% # 33은 100에서 몇 퍼센트? print "%.2f%%" % (33.0 / 100.0 * 100.0) # 출력 결과: 33.00% # 105는 300의 몇퍼센트? print "%.2f%%" % (105.0 / 300.0 * 100.0) # 출력 결과: 35.00% # 한달 봉급 156만원인 사람이, 음식 값..
2022.01.11 -
파이썬 현재시간과 특정시간에서 동작하기
파이썬 time 모듈 중, 특정시간에 동작하는 기능을 알아봅니다. 아래 코드 참조해 주세요 import schedule import time import datetime import sys #스케쥴 모듈이 동작시킬 코드 : 현재 시간 출력 def test_function(): now = datetime.datetime.now() print("test code- 현재 시간 출력하기") print(now) #프로그램을 종료시키기 위한 함수 def exit(): print("function exit") sys.exit() #1초마다 test_fuction을 동작시키다가 "08:23"이 되면 프로그램 종료 schedule.every(1).seconds.do(test_function) schedule.every(..
2022.01.11 -
Python (Variables)
Python (Variables) (Variable) is the name of the space used to store data in memory. Data or objects stored in variables can change continuously within a program. Learn how to declare and use variables. The sequence is as follows. Variable declaration and assignment Naming Variables Variable declaration and assignment In Python, declaration and assignment of variables occurs simultaneously. decl..
2022.01.02 -
Python (Basics)
Python (Basics) Learn the basics of the Python programming language. The sequence is as follows. (Keyword) (Identifier) (Indentation) (Comment) (Keyword) (Keyword) is a string that is already reserved in the Python language, It cannot be used as the name of a variable or function, etc. There are 33 keywords in Python, as listed below. False, None, True, and, as, assert, break, class, continue, d..
2022.01.02 -
Python - Getting Started with Programming
Python - Getting Started with Programming Python is a dynamic typing, object-oriented programming language. Python is a high-level, general-purpose, multi-platform, interpreted language. The design goal of the Python language is to focus on programmer productivity and readability of code. Python is oriented towards minimalism. One of the most striking features is that it does not use semicolons ..
2022.01.02