목록개발/개인공부 (24)
[2024-07-29 17:01:26] 매수 완료 {'uuid': '?', 'side': 'bid', 'ord_type': 'price', 'price': '10000', 'state': 'wait', 'market': 'KRW-BTC', 'created_at': '2024-07-29T17:01:27+09:00', 'reserved_fee': '5', 'remaining_fee': '5', 'paid_fee': '0', 'locked': '10005', 'executed_volume': '0', 'trades_count': 0} [2024-07-30 01:01:27] 매도 완료 {'uuid': '?', 'side': 'ask', 'ord_type': 'market', 'state': 'wait', 'ma..
1분 봉 차트로 원하는 지점에서 매수 및 매도가 되는지 확인했다. from config.config import UPBIT_API_KEY, UPBIT_SECRET_KEY, UPBIT_SERVER_URLimport pyupbitdef get_jwt_token(): upbit = pyupbit.Upbit(UPBIT_API_KEY, UPBIT_SECRET_KEY) return upbitapi.py이다.여기는 그냥 token값만 가져올 수 있게 했다. import pandas as pdimport pyupbitdef get_account_info(upbit, coin_name): return upbit.get_balance(ticker=coin_name)def get_BB(): df ..
def get_BB(): df = pyupbit.get_ohlcv("KRW-BTC", interval="minute240") data_BB = modules.data_processing.Bollinger_Band(df) return [df, data_BB]pyupbit 라이브러리를 활용해 쉽게 캔들 정보와 지표들을 활용할 수 있었다.매매나 계좌정보도 가능한 것 같다.get_ohlcv를 통해 캔들정보를 가져오고 볼린저밴드를 계산해 준다.4시간 차트기준이다. def Bollinger_Band(df): pd.set_option('display.float_format', lambda x: '%.2f' % x) df['middle'] = df['close'].rolling(window=..
투자 전략을 고민했다.오랜 시간 프로그램을 돌리며 안전성과 수입률을 생각해 보았을 때볼린저밴드 4시간 차트를 활용한 매매기법을 사용하기로 했다. 매매기법의 조건이다.진입 조건 : 캔들 몸통의 중앙이 볼린저밴드 상단선 돌파시손절 조건 : 진입 근거가 됐던 캔들의 저점으로 잡음익절 조건 : 꼬리를 제외한 음봉 캔들의 몸통 전체가 볼린저밴드 상단선 안으로 처음 들어왔을 때해당 매매기법은 큰 수익보다는 안전성에 우선시했다.프로젝트가 더욱 안전성 있고 완성이 되어가면투자전략을 바꾸어볼 생각이다.초록색 부분이 수익을 얻을 수 있는 구간이다.하락장에서도 대비할 수 있는 기법이다.하지만 강세장에서는 안전성으로 수입을 얻지만약간의 횡보하는 구간에서는 손해가 날수도 있다.즉 큰 시장의 흐름을 자신이 판단한 후에 프로그램..
오늘은 나의 계좌정보에 대한 정보와코인들의 정보들 가져와보았다. def get_ticker(coin_name): headers = {"accept": "application/json"} response = requests.get(UPBIT_SERVER_URL + '/v1/ticker?markets=' + coin_name, headers=headers) return response.json()def get_candle_info(coin_name): headers = {"accept": "application/json"} response = requests.get(UPBIT_SERVER_URL + '/v1/candles/minutes/240?market=' + coin_name..
먼저 Upbit API를 활용해서 비트코인 종목을 위주로 매매를 진행하는 프로그램을 제작해 보기로 했다.주식에 대한 지식도 많은 편은 아니지만 계속 공부해가며 코드를 수정해 나갈 예정이다. 현재의 디렉터리 구상도이다.프로젝트를 진행하면서 계속 바뀔것이다. project/│├── config/│ ├── config.py # 설정 파일│├── modules/│ ├── api.py # API 통신 모듈│ ├── data_processing.py # 데이터 처리 모듈│ ├── strategy.py # 매매 전략 모듈│ ├── logger.py # 로깅 모듈│├── tests/│ ├── test_api.py # API 모듈 테..
#include #include #include #include #include #include #include #include #include // ICMP 체크섬 계산 함수unsigned short checksum(void *b, int len) { unsigned short *buf = (unsigned short *)b; unsigned int sum = 0; unsigned short result; for (sum = 0; len > 1; len -= 2) sum += *buf++; if (len == 1) sum += *(unsigned char *)buf; sum = (sum >> 16) + (sum & 0xFFFF); sum +..
ICMP 패킷을 보내고 다시 받은 패킷의 src IP를 추출했다. #include #include #include #include #include #include // ICMP 체크섬 계산 함수unsigned short checksum(void *b, int len) { unsigned short *buf = (unsigned short *)b; unsigned int sum = 0; unsigned short result; for (sum = 0; len > 1; len -= 2) sum += *buf++; if (len == 1) sum += *(unsigned char *)buf; sum = (sum >> 16) + (sum & 0xFFFF..