Initial commit

This commit is contained in:
Yaser
2026-08-13 19:50:53 +03:30
commit 38084458fe
879 changed files with 95198 additions and 0 deletions

21
lib/peatio/kline_db.rb Normal file
View File

@@ -0,0 +1,21 @@
# encoding: UTF-8
# frozen_string_literal: true
module KlineDB
class << self
def redis
@redis ||= Redis.new(
url: ENV["REDIS_URL"],
db: 1
)
end
def kline(market, period)
key = "peatio:#{market}:k:#{period}"
length = redis.llen(key)
data = redis.lrange(key, length - 5000, -1).map{|str| JSON.parse(str)}
end
end
end