Skip to content

Instantly share code, notes, and snippets.

View berkorbay's full-sized avatar
🏄

Berk Orbay berkorbay

🏄
  • Tideseed
  • Istanbul, Turkey
  • 20:22 (UTC +03:00)
View GitHub Profile
@berkorbay
berkorbay / redis_tahta.py
Created November 18, 2025 14:18
gip2logger Örnekleri
from redis import Redis
from dotenv import load_dotenv
import os
### .env dosyasına Redis bağlantı bilgilerini ekleyebilirsiniz.
load_dotenv()
## Redis bağlantısı kurun
r = Redis(
host=os.getenv("REDIS_HOST"),
@berkorbay
berkorbay / gop_ia_gip_pozisyon.py
Last active November 19, 2025 16:17
eptr2 Örnekleri
from eptr2.composite.dabi_idm import get_dabi_idm_data
from eptr2 import EPTR2
### .env dosyasında email, şifre tanımlı olmalı
eptr = EPTR2(recycle_tgt=True)
### GÖP, İA, GİP Alış/Satış hepsi tek bir fonksiyon
res = get_dabi_idm_data(
eptr=eptr,
start_date="2025-11-18",
@berkorbay
berkorbay / eptr2_mcp.py
Created July 16, 2025 13:43
EPTR2 MCP Server v0
from typing import Any
import httpx
from mcp.server.fastmcp import FastMCP
from eptr2.main import eptr_w_tgt_wrapper, EPTR2
import pandas as pd
# Initialize FastMCP server
mcp = FastMCP("eptr2")
eptr = eptr_w_tgt_wrapper()
@berkorbay
berkorbay / eptr2_cost_calc.py
Created February 25, 2025 18:26
Imbalance and KUPST costs using EPTR2
from eptr2.util.costs import calculate_diff_cost
res = calculate_diff_cost(
actual=50, forecast=100, mcp=1000.0, smp=2500.0, prod_source="solar"
)
## print(res)
# {
# "imbalances": {
# "diff": -50,
@berkorbay
berkorbay / eptr2.R
Created May 1, 2024 09:50
eptr2 Python paketini R ile kullanmak
library(tidyverse)
library(reticulate)
if(FALSE){
print("Installing python packages")
reticulate::py_install("eptr2")
reticulate::py_install("pandas")
reticulate::py_install("urllib3")
}
eptr2 <- reticulate::import("eptr2")
eptr_obj <- eptr2$EPTR2()
@berkorbay
berkorbay / gip_3.py
Created January 4, 2024 13:13
İlk 3 Gün GİP Hacimleri Karşılaştırması
## GİP Hacim Karşılaştırma
from eptr2 import EPTR2
import re
import pandas as pd
eptr = EPTR2()
idm_qty_24 = eptr.call("idm-qty", start_date="2024-01-01", end_date="2024-01-03")
idm_qty_23 = eptr.call("idm-qty", start_date="2023-01-01", end_date="2023-01-03")
idm_vol_24 = eptr.call("idm-volume", start_date="2024-01-01", end_date="2024-01-03")
@berkorbay
berkorbay / launch.json
Created November 20, 2023 15:03
Streamlit debug config for VS Code
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Streamlit: App",
"type": "python",
"request": "launch",
@berkorbay
berkorbay / Dockerfile
Created November 13, 2023 12:11
Deploying Shiny Python on Cloud Run on GCP with Macbook M1 and later
FROM python:3.10-slim
ENV APP_HOME /app
WORKDIR $APP_HOME
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
ENV PORT 8080
RUN pip install --no-cache-dir --upgrade shiny
@berkorbay
berkorbay / rs256_jose.py
Last active October 5, 2023 10:30
Working method for generating RS256 private/public JWT keys without problem in py-jose
from jose import jwt
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
#https://dev.to/aaronktberry/generating-encrypted-key-pairs-in-python-69b
private_key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048
)
@berkorbay
berkorbay / hizli_blok_bot_v0.py
Created August 25, 2023 16:04
Robokami hızlı blok bot
### DİKKAT!
### İlgili bot sadece Robokami'nin işleyişini gösterim amaçlıdır.
### Robokami ve Tideseed botun çalışması ve işlevi dahil hiçbir konuda bir garanti vermemektedir ve herhangi bir sorumluluk kabul etmemektedir.
### İlgili kodun lisansı Apache License 2.0 lisansına uygundur.
### Detaylı bilgi ve sorular için https://robokami.com adresine başvurabilirsiniz.
from robokami.main import RKClient
import json
import copy
## Birinci hesabın bilgileri