PSC daily candle history and pixel candlestick chart

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Opus 5.5 committed 2026-11-04 08:47:34 +08:00
1 parent 7b5080984a
commit b8308e1010
10 files changed
+271 -4

No files matched your search

+7
View File
@@ -2,6 +2,13 @@
## 未发布
### 行情图
- PSC 日 K:存档里新增逐日 K 线历史(`CandleBook`,保留 60 天)。开盘接前一天的收盘价(币是全天候交易的,夜里的回归和开门波动算进当天这根,没有跳空);最高 / 最低只取白天真实发生过的价格(开门波动、NPC 大户、插针、玩家在 Poinbase 的大单),不编造日内走势;收盘是夜间结算前、插针回去之后的价格。成交量分大户和玩家两份。旧存档没有历史,从接入当天开始记录。
- K 线图:运行时画在一张 188×97 的纹理上,点采样放大 2 倍显示,和游戏的像素风格一致。最近 30 根,涨绿跌红、影线、黄色 7 日均线(永续资金费按它算),下方成交量柱(灰 大户 / 青 你的成交),当天还没收盘的蜡烛画成空心;上方一行写最高、最低、收盘和涨跌幅。出现在 Poinbase 现货页、永续页,以及预测页选中 PSC 价格盘时(加一条蓝色阈值虚线)。
- 调试入口"Chart: run market 30 days":用真实的行情过程往前跑 30 天并记录蜡烛(会改动这一局的 PSC 价格,只在测试存档用)。
- 游戏内验证:三处都显示正常,30 根蜡烛、均线、成交量柱、阈值虚线(PSC 价格 ≥ 104)。没有在游戏里验证:按真实日程一天天积累(只用调试入口跑过)、英文界面。
### 第七阶段:预测市场、操纵与骗局(7.1、7.2、7.3)
- 阶段 7 数值总复核(ops `research/stage7sim`,用真实的域层,30 天平均每天净收益,对照原版第 30 天约 1,990 / 天的毛收入)。改动:
+82
View File
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Decentralized.Domain
{
/// <summary>一天一根蜡烛:开盘接前一天的收盘价、包括夜间变动和白天真实发生过的最高 / 最低、夜间结算前的收盘价;成交额分玩家和 NPC 大户(信用点)。</summary>
public sealed class Candle
{
public int Day;
public double O, H, L, C, VolPlayer, VolNpc;
public bool Closed;
}
/// <summary>
/// 日 K 历史(按币种)。开门时开一根,白天的价格变动(开门波动、插针、大户、玩家大单)更新高低和现价,夜间结算时收盘。
/// 没有发生过的日内走势不编造:没有事件的日子高低就等于开收。
/// </summary>
public sealed class CandleBook
{
public const int Keep = 60;
public Dictionary<string, List<Candle>> Series = new Dictionary<string, List<Candle>>();
public List<Candle> Of(string asset) => Series.TryGetValue(asset, out var s) ? s : new List<Candle>();
/// <summary>今天的蜡烛:没有就按现价开一根(读档时补上,开盘价就是读档时的价格)。</summary>
public Candle Today(string asset, int day, double price)
{
if (!Series.TryGetValue(asset, out var s)) Series[asset] = s = new List<Candle>();
var c = s.Count > 0 ? s[s.Count - 1] : null;
if (c != null && c.Day == day) return c;
c = new Candle { Day = day, O = price, H = price, L = price, C = price };
s.Add(c);
while (s.Count > Keep) s.RemoveAt(0);
return c;
}
/// <summary>
/// 开门:新开一根。币是全天候交易的,所以开盘价接昨天的收盘价,夜里的回归和开门波动都算进这根蜡烛(没有跳空);
/// 没有昨天的(刚开始记录)就从现价开。
/// </summary>
public void Open(string asset, int day, double price)
{
var s = Of(asset);
var prev = s.Count > 0 && s[s.Count - 1].Day < day ? s[s.Count - 1] : null;
var c = Today(asset, day, price);
if (c.Closed) return;
double o = prev != null ? prev.C : price;
c.O = o; c.H = Math.Max(o, price); c.L = Math.Min(o, price); c.C = price;
}
/// <summary>白天的价格变动。</summary>
public void Tick(string asset, int day, double price, double volume = 0, bool player = false)
{
var c = Today(asset, day, price);
if (c.Closed) return;
c.H = Math.Max(c.H, price); c.L = Math.Min(c.L, price); c.C = price;
if (player) c.VolPlayer += Math.Abs(volume); else c.VolNpc += Math.Abs(volume);
}
/// <summary>夜间结算:收盘。</summary>
public void Close(string asset, int day, double price)
{
Tick(asset, day, price);
Today(asset, day, price).Closed = true;
}
/// <summary>收盘价的 n 日均线(不足 n 根时用已有的);每根蜡烛一个值。</summary>
public static List<double> Ma(IList<Candle> s, int n)
{
var r = new List<double>();
for (int i = 0; i < s.Count; i++)
{
int a = Math.Max(0, i - n + 1);
double sum = 0;
for (int j = a; j <= i; j++) sum += s[j].C;
r.Add(sum / (i - a + 1));
}
return r;
}
}
}
+115
View File
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Decentralized.Domain;
using UnityEngine;
namespace Decentralized
{
/// <summary>
/// 日 K 图:运行时画到一张小 Texture2D 上(一根蜡烛 5 像素宽、间隔 1),点采样放大 2 倍显示,和游戏的像素风格一致。
/// 上面是价格(涨绿跌红、影线、7 日均线、可选阈值虚线),下面是成交量(玩家青色叠在大户灰色上)。纹理按用途缓存复用。
/// </summary>
public static class CandleChart
{
public const int Days = 30, Step = 6, Body = 5, PriceH = 70, Gap = 3, VolH = 16, Pad = 2;
public const int W = Days * Step + Pad * 2, H = PriceH + Gap + VolH + Pad * 2;
public const float Scale = 2f;
private static readonly Color32 Bg = new Color32(30, 31, 34, 255), Grid = new Color32(48, 50, 54, 255);
private static readonly Color32 Up = new Color32(108, 190, 112, 255), Down = new Color32(214, 94, 88, 255);
private static readonly Color32 Ma = new Color32(226, 196, 92, 255), Thr = new Color32(150, 170, 230, 255);
private static readonly Color32 VolNpc = new Color32(92, 96, 104, 255), VolMe = new Color32(96, 200, 210, 255);
private sealed class Slot { public Texture2D Tex; public Sprite Sprite; public Color32[] Px; }
private static readonly Dictionary<string, Slot> Slots = new Dictionary<string, Slot>();
/// <summary>画一张图,返回可以交给 AddImage 的 Sprite。threshold &gt; 0 时画一条水平虚线(预测盘的阈值)。</summary>
public static Sprite Render(string key, IList<Candle> all, double threshold = 0)
{
if (!Slots.TryGetValue(key, out var s) || s.Tex == null)
{
var tex = new Texture2D(W, H, TextureFormat.RGBA32, false) { filterMode = FilterMode.Point, wrapMode = TextureWrapMode.Clamp };
s = Slots[key] = new Slot { Tex = tex, Px = new Color32[W * H], Sprite = Sprite.Create(tex, new Rect(0, 0, W, H), new Vector2(0.5f, 0.5f), 100f) };
}
var px = s.Px;
for (int i = 0; i < px.Length; i++) px[i] = Bg;
var c = all.Skip(Math.Max(0, all.Count - Days)).ToList();
int volY0 = Pad, priceY0 = Pad + VolH + Gap;
// 网格:价格区四等分
for (int g = 1; g < 4; g++) HLine(px, Pad, W - Pad - 1, priceY0 + PriceH * g / 4, Grid);
if (c.Count > 0)
{
var ma = CandleBook.Ma(all, 7).Skip(Math.Max(0, all.Count - Days)).ToList();
double lo = Math.Min(c.Min(x => x.L), ma.Min()), hi = Math.Max(c.Max(x => x.H), ma.Max());
if (threshold > 0) { lo = Math.Min(lo, threshold); hi = Math.Max(hi, threshold); }
double span = Math.Max(hi - lo, hi * 0.02);
lo -= span * 0.05; hi += span * 0.05; span = hi - lo;
Func<double, int> y = p => priceY0 + (int)Math.Round((p - lo) / span * (PriceH - 1));
double vmax = Math.Max(1, c.Max(x => x.VolPlayer + x.VolNpc));
int x0 = Pad + (Days - c.Count) * Step; // 不足 30 根时靠右
for (int i = 0; i < c.Count; i++)
{
var k = c[i];
int left = x0 + i * Step, mid = left + Body / 2;
var col = k.C >= k.O ? Up : Down;
VLine(px, mid, y(k.L), y(k.H), col);
int b0 = y(Math.Min(k.O, k.C)), b1 = Math.Max(b0, y(Math.Max(k.O, k.C)));
for (int xx = left; xx < left + Body; xx++)
{
// 当天还没收盘的蜡烛画成空心
if (!k.Closed && xx > left && xx < left + Body - 1 && b1 - b0 > 1) { Set(px, xx, b0, col); Set(px, xx, b1, col); continue; }
VLine(px, xx, b0, b1, col);
}
int hn = (int)Math.Round(k.VolNpc / vmax * VolH), hm = (int)Math.Round(k.VolPlayer / vmax * VolH);
for (int xx = left; xx < left + Body; xx++)
{
if (hn > 0) VLine(px, xx, volY0, volY0 + hn - 1, VolNpc);
if (hm > 0) VLine(px, xx, volY0 + hn, volY0 + hn + hm - 1, VolMe);
}
}
for (int i = 1; i < ma.Count; i++) Line(px, x0 + (i - 1) * Step + Body / 2, y(ma[i - 1]), x0 + i * Step + Body / 2, y(ma[i]), Ma);
if (threshold > 0) { int ty = y(threshold); for (int xx = Pad; xx < W - Pad; xx++) if ((xx / 3) % 2 == 0) Set(px, xx, ty, Thr); }
}
s.Tex.SetPixels32(px);
s.Tex.Apply(false);
return s.Sprite;
}
/// <summary>图上方的一行说明:最高、最低、最新收盘,涨跌。</summary>
public static string Caption(IList<Candle> all)
{
var c = all.Skip(Math.Max(0, all.Count - Days)).ToList();
if (c.Count == 0) return L.T("chart.empty");
var last = c[c.Count - 1];
double prev = c.Count > 1 ? c[c.Count - 2].C : last.O, chg = prev > 0 ? last.C / prev - 1 : 0;
return L.T("chart.caption", c.Count, Fmt.Num(c.Max(x => x.H)), Fmt.Num(c.Min(x => x.L)), Fmt.Num(last.C), (chg * 100).ToString("+0.0;-0.0;0.0", CultureInfo.InvariantCulture));
}
private static void Set(Color32[] px, int x, int y, Color32 c) { if (x >= 0 && x < W && y >= 0 && y < H) px[y * W + x] = c; }
private static void HLine(Color32[] px, int x0, int x1, int y, Color32 c) { for (int x = x0; x <= x1; x++) Set(px, x, y, c); }
private static void VLine(Color32[] px, int x, int y0, int y1, Color32 c) { if (y1 < y0) (y0, y1) = (y1, y0); for (int y = y0; y <= y1; y++) Set(px, x, y, c); }
private static void Line(Color32[] px, int x0, int y0, int x1, int y1, Color32 c)
{
int dx = Math.Abs(x1 - x0), dy = -Math.Abs(y1 - y0), sx = x0 < x1 ? 1 : -1, sy = y0 < y1 ? 1 : -1, err = dx + dy;
while (true)
{
Set(px, x0, y0, c);
if (x0 == x1 && y0 == y1) break;
int e2 = 2 * err;
if (e2 >= dy) { err += dy; x0 += sx; }
if (e2 <= dx) { err += dx; y0 += sy; }
}
}
/// <summary>把图放进界面:说明一行、图、图例一行。</summary>
public static void Add(CustomUIBuilder b, string key, IList<Candle> all, double threshold = 0)
{
b.AddLabel(Caption(all));
b.AddImage(Render(key, all, threshold), W * Scale, H * Scale);
b.AddLabel(L.T(threshold > 0 ? "chart.legend.thr" : "chart.legend"));
}
}
}
+17
View File
@@ -114,6 +114,23 @@ namespace Decentralized
m.clientStack.Insert(0, c);
PlayerStore.Instance.TryCallNextClient();
}));
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Chart: run market 30 days (test)", () => Log.Guard("K 线测试", () =>
{
// 用真实的行情过程往前跑 30 天,记录蜡烛(会改动这一局的 PSC 价格,只在测试存档用)
var d = Session.Data; int day0 = StoreStation.GetDayCounter() - 30; var none = new List<MarketEvent>();
d.Candles.Series.Remove(Assets.PSC);
for (int k = day0; k < day0 + 30; k++)
{
d.Market.Open(none, d.Rng, k); d.Candles.Open(Assets.PSC, k, d.Market.Price);
double wh = d.Market.Whale(d.Rng); d.Candles.Tick(Assets.PSC, k, d.Market.Price, wh);
if (d.Market.TryWick(d.Rng, k) != 0) d.Candles.Tick(Assets.PSC, k, d.Market.Price);
if (d.Rng.Chance(0.3)) { double v = d.Rng.Range(500.0, 4000.0); bool buy = d.Rng.Chance(0.5); if (buy) d.Market.Main.BuyBase(v); else d.Market.Main.SellBase(v / d.Market.Price); d.Candles.Tick(Assets.PSC, k, d.Market.Price, v, true); }
d.Market.UndoWick(k); d.Candles.Close(Assets.PSC, k, d.Market.Price);
d.Market.Night(none, d.Rng, k, Session.Price); d.Market.UpdateSupply(k);
}
d.Candles.Open(Assets.PSC, day0 + 30, d.Market.Price);
Log.Info($"测试:K 线 {d.Candles.Of(Assets.PSC).Count} 根,PSC {d.Market.Price:0.00}");
}));
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Predict: window = tomorrow (test)", () => { foreach (var m in Session.Data.Predict.Markets) { m.FromDay = m.ToDay = StoreStation.GetDayCounter() + 1; } Log.Info("测试:所有盘口窗口改成明天"); });
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Perp fund 0 (test)", () => { Session.Data.Perps.InsuranceFund = 0; Log.Info("测试:保险基金清零"); });
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "SPARK x0.3 (test)", () => { var st = Session.Data.Stable; st.Spark *= 0.3; Log.Info($"测试:SPARK 价格 {st.Spark:0.00}"); });
@@ -268,7 +268,7 @@ black.kind.Contraband.3,Contraband (high)
black.kind.Tech,High-tech (markup)
nightlog.bm.ready,"Black market: {0} arrived; a courier will come by once you open."
item.web3guide.name,Web3 Handbook
item.web3guide.desc,"Bank: depositing turns credits into CRC in your Poinbase account; withdrawing turns CRC back into credits and goes through compliance screening, which looks at the Poinbase account's taint. Trading: buys are paid in the quote coin, sells in the traded coin. Mixer: pick a coin, amount and rounds; each round takes a fee and lowers taint, rounds equal days of waiting, and the coins come back to the same address; the more you deposit, the worse the cleaning. Hardware wallets: on-chain coins sit in PLEDGER hardware wallets, each with its own balances and taint; open and connect them on the terminal's Wallets page. The Web3 page's trading, black market and mixer use the connected wallet, and coin-paying customers and mining rewards go into it too. Payments (black market, mixer, Ponero desk, listing fees) start as an invoice on the terminal; type the payee address on the wallet and hold ✓ to sign. The last two characters of an address are a checksum, so a one-character typo is usually caught; once in a while it happens to be valid and the coins go to an address nobody uses. DEX swaps also need a signature on the wallet. RatDigg miners (M1 / M2 / M3) are standalone machines with far more hash than a card and a lower power draw per hash; they need a battery, take modules and use no rig slots. Only the black market's miner dealers sell them, gated by black-market standing (M1 40, M2 60, M3 80), sometimes second-hand. When one burns out, repair it by putting electronic components in its repair slot in order; it comes back 20 health lower. Somewhere between day 50 and day 90 a "miner era" arrives, announced in the paper a few days earlier: the big farms halve their power costs, network hash climbs, GPU miners are diluted and low-end cards barely earn, while miners still do fine. Perps: the Perps tab on Poinbase uses your account CRC as margin, up to 5× on PSC and 3× on SPARK, one position per product, never long and short at once. Fills are worse than the quote (more so for bigger orders, like the spot pool) and opening and closing both cost a fee. Liquidation is checked only overnight against the day's average price: equity under 10% of notional wipes the margin. There is also a nightly funding payment; when the price is above its 7-day average, longs pay shorts. If a liquidation loses more than the margin, the insurance fund covers the gap; when it runs dry (a SPARK collapse can do that) winning positions are auto-deleveraged and give up half their profit; anything beyond that becomes your debt. Debt grows 2% a day, is repaid first from CRC in the account every night, blocks new positions and cash-outs, and after seven days items in your shop are seized to cover it; whatever is still short is written off and the perp account is banned for 30 days. Poinbase is a custodial account and can withdraw straight to the connected wallet; depositing from a wallet means sending to Poinbase's deposit address, which takes only CRC and PSC. More hardware wallets are sold by Dr. Jackson; drag one onto the trading terminal to add it, up to 5. The black market has cheaper ones. A wallet you no longer want can be destroyed on the Wallets page once its coins are moved out. Transfers pay a fee: slow, normal or fast, and gas prices rise and fall over roughly a week; when the network is congested fees rise and slow transactions may be dropped from the mempool. Check the full address before sending. Staking: CRA staked in the Revolution pool earns a daily rate that compounds into the stake; withdrawing means requesting first and waiting four days, with no interest while waiting and no way to take it early. The pool pays from a subsidy fund; when it runs low the rate is cut and word of big holders pulling out may spread. Treat that as a warning: once it collapses CRA is worthless within three days and four days of unlocking is too slow. The balance token SPARK can be minted and burned against CRA at the going price (with a fee); its price swings hard and crashes with the collapse. Staking, minting and burning are contract calls and need a signature on the wallet. Black market: coin only, no CRC, 30% above normal channels, with extra markup on high-tech goods and GPUs; the coin you pay leaves its share of taint with the seller and the goods carry no stolen tag; GPUs may be fake, inspect them yourself. Orders are cheaper than spot but take days and may be intercepted; merchants sell by type at their own price factor, 5+ items get 5% off and 10+ get 10% off, and a bulk merchant appears at random with the lowest prices but six days of waiting; escrow costs 5%, is released on delivery and refunded if the seller runs; advance release takes another 10% off, but a scammer keeps the money and only sellers with 30+ trades accept; the platform itself can rug, be taken over by enforcement, or a seller can be arrested, after which your orders get traced and crime logged; forum rumors can be warnings. An intercepted parcel sometLine truncated
item.web3guide.desc,"Bank: depositing turns credits into CRC in your Poinbase account; withdrawing turns CRC back into credits and goes through compliance screening, which looks at the Poinbase account's taint. Trading: buys are paid in the quote coin, sells in the traded coin. Mixer: pick a coin, amount and rounds; each round takes a fee and lowers taint, rounds equal days of waiting, and the coins come back to the same address; the more you deposit, the worse the cleaning. Hardware wallets: on-chain coins sit in PLEDGER hardware wallets, each with its own balances and taint; open and connect them on the terminal's Wallets page. The Web3 page's trading, black market and mixer use the connected wallet, and coin-paying customers and mining rewards go into it too. Payments (black market, mixer, Ponero desk, listing fees) start as an invoice on the terminal; type the payee address on the wallet and hold ✓ to sign. The last two characters of an address are a checksum, so a one-character typo is usually caught; once in a while it happens to be valid and the coins go to an address nobody uses. DEX swaps also need a signature on the wallet. RatDigg miners (M1 / M2 / M3) are standalone machines with far more hash than a card and a lower power draw per hash; they need a battery, take modules and use no rig slots. Only the black market's miner dealers sell them, gated by black-market standing (M1 40, M2 60, M3 80), sometimes second-hand. When one burns out, repair it by putting electronic components in its repair slot in order; it comes back 20 health lower. Somewhere between day 50 and day 90 a "miner era" arrives, announced in the paper a few days earlier: the big farms halve their power costs, network hash climbs, GPU miners are diluted and low-end cards barely earn, while miners still do fine. Perps: the Perps tab on Poinbase uses your account CRC as margin, up to 5× on PSC and 3× on SPARK, one position per product, never long and short at once. Fills are worse than the quote (more so for bigger orders, like the spot pool) and opening and closing both cost a fee. Liquidation is checked only overnight against the day's average price: equity under 10% of notional wipes the margin. There is also a nightly funding payment; when the price is above its 7-day average, longs pay shorts. If a liquidation loses more than the margin, the insurance fund covers the gap; when it runs dry (a SPARK collapse can do that) winning positions are auto-deleveraged and give up half their profit; anything beyond that becomes your debt. Debt grows 2% a day, is repaid first from CRC in the account every night, blocks new positions and cash-outs, and after seven days items in your shop are seized to cover it; whatever is still short is written off and the perp account is banned for 30 days. Poinbase is a custodial account and can withdraw straight to the connected wallet; depositing from a wallet means sending to Poinbase's deposit address, which takes only CRC and PSC. More hardware wallets are sold by Dr. Jackson; drag one onto the trading terminal to add it, up to 5. The black market has cheaper ones. A wallet you no longer want can be destroyed on the Wallets page once its coins are moved out. Transfers pay a fee: slow, normal or fast, and gas prices rise and fall over roughly a week; when the network is congested fees rise and slow transactions may be dropped from the mempool. Check the full address before sending. Staking: CRA staked in the Revolution pool earns a daily rate that compounds into the stake; withdrawing means requesting first and waiting four days, with no interest while waiting and no way to take it early. The pool pays from a subsidy fund; when it runs low the rate is cut and word of big holders pulling out may spread. Treat that as a warning: once it collapses CRA is worthless within three days and four days of unlocking is too slow. The balance token SPARK can be minted and burned against CRA at the going price (with a fee); its price swings hard and crashes with the collapse. Staking, minting and burning are contract calls and need a signature on the wallet. Black market: coin only, no CRC, 30% above normal channels, with extra markup on high-tech goods and GPUs; the coin you pay leaves its share of taint with the seller and the goods carry no stolen tag; GPUs may be fake, inspect them yourself. Orders are cheaper than spot but take days and may be intercepted; merchants sell by type at their own price factor, 5+ items get 5% off and 10+ get 10% off, and a bulk merchant appears at random with the lowest prices but six days of waiting; escrow costs 5%, is released on delivery and refunded if the seller runs; advance release takes another 10% off, but a scammer keeps the money and only sellers with 30+ trades accept; the platform itself can rug, be taken over by enforcement, or a seller can be arrested, after which your orders get traced and crime logged; forum rumors can be warnings. An intercepted parcel sometLine truncated
courier.odd1,...Package is here.
courier.odd2,"(His hand stays in his pocket.) Sign here."
courier.sign,Sign
@@ -727,3 +727,7 @@ predict.kind.Cra,CRA warning
predict.kind.Era,ASIC era
nightlog.predict.move,"Prediction ""{0}"" moved {1} -> {2}"
nightlog.predict.why, ({0})
chart.empty,PSC daily chart: no history yet; recording from today.
chart.caption,PSC daily ({0} days) H {1} L {2} C {3} ({4}%)
chart.legend,"<size=80%>green up, red down; yellow 7-day MA; bars: grey whales / cyan you</size>"
chart.legend.thr,"<size=80%>green up, red down; yellow 7-day MA; blue dashes threshold</size>"
@@ -267,7 +267,7 @@ black.kind.Contraband.3,违禁品(高)
black.kind.Tech,高科技物品(加价)
nightlog.bm.ready,"黑市:{0} 到货,开店后会有快递员上门。"
item.web3guide.name,Web3 手册
item.web3guide.desc,"银行:存入把信用点换成 Poinbase 账户里的 CRC;提取把 CRC 换回信用点,要过合规审查,审查看 Poinbase 账户的污点。交易:买入按计价币的数量支付,卖出按所交易币的数量卖出。混币器:选币种、填数量和轮数,每轮扣手续费并降低污点,轮数即等待天数,到期提回同一个地址;存入越多,清洗越差。硬件钱包:链上的币放在 PLEDGER 硬件钱包里,每个钱包的余额和污点各算各的;在终端的钱包页打开、连接。Web3 页的交易、黑市、混币器用已连接的钱包,用币付款的顾客和挖矿收益也进它。付款(黑市、混币器、Ponero 兑换处、上架费)先在终端开账单,再在钱包里手输收款地址、按住 ✓ 签名;地址末尾两位是校验位,输错一位多半会被拦下,偶尔碰巧合法,币就转进了没人用的地址。DEX 兑换也要在钱包上签名。Poinbase 是托管账户,可以直接提到已连接的钱包;从钱包充值要转到 Poinbase 的充值地址,只收 CRC 和 PSC。更多硬件钱包向杰克逊博士购买,拖到交易终端上添加,最多 5 个;黑市上也有更便宜的。不要的钱包可以在钱包页销毁,要先把币转走。转账要付手续费,分慢、普通、快三档,gas 价格大约一周一个起落;网络拥堵时手续费变贵,慢档可能被挤出内存池。转账前核对完整地址。质押:把 CRA 质押进革命军质押池每天有日息,利息并入本金;取出要先申请,等四天才到账,等待期间没有利息,也不能提前拿。质押池靠补贴池付息,补贴池见底会降息,有时还会传出大户撤出的消息,那是预兆:一旦崩盘,三天内 CRA 就一文不值,四天的解锁期来不及。平衡代币 SPARK 可以和 CRA 按价格互相铸销(收手续费),价格波动很大,崩盘时会跟着暴跌。质押、铸销都是合约调用,要在钱包上签名。RatDigg 矿机(M1 / M2 / M3)是独立的机器,算力比显卡大得多、耗电更省,要放电池才挖,可以放模块,不占矿架槽位;只在黑市的矿机商那里有,要黑市声望(M1 40、M2 60、M3 80),偶尔有二手的。暴毙后要往修理槽里放电子元件按顺序修好,修好健康少 20。第 50 到 90 天之间会有一次"矿机时代",提前几天上报纸预告,之后大矿场的耗电成本砍半,全网算力涨上去,显卡矿工的收益被摊薄,低档显卡几乎不赚钱,矿机还行。永续合约:Poinbase 的"永续"页,用账户里的 CRC 当保证金,PSC 最高 5 倍、SPARK 最高 3 倍,一个品种只有一个仓位,不能同时多空。成交价比现价差一截(单越大差得越多,和现货池一样),开平仓还收手续费。强平只在夜里按当天均价检查,权益不到名义价值的 10% 就被强平,保证金没了;每晚还有资金费,价格比近 7 天均价高时多头付给空头。强平后亏光保证金还不够的缺口,先由保险基金垫,基金见底(SPARK 崩盘这类大行情会抽干它)后盈利的仓位会被自动减仓、少拿一半盈利,再不够就记成你的欠款:欠款每天涨 2%,账户里的 CRC 每晚先拿去还,没还清不能开仓、不能出金,七天不还就没收店里的物品抵债,抵不够的核销并拉黑永续账户 30 天。黑市:只收币,不收 CRC,价格比正常渠道贵 30%,高科技物品和显卡另有加价;付出去的币带着按比例的污点留在卖家那边,货不带赃物标签;显卡不保证真假,自己鉴定。订单比现货便宜,要等几天,路上可能被截获;商家按类型卖货,价格系数各不相同,一次订 5 件以上 95 折、10 件以上 9 折,大宗商家随机出现,价格最低但要等六天;托管多付 5% 托管费,收货后放款,卖家跑路时退款;提前放款再打九折,卖家若是骗子钱就没了,只有成交 30 单以上的卖家接受;平台自己也可能跑路,也可能被执法接管,或者卖家落网,之后你的订单会被追查、记罪证;论坛上的传闻可以当预兆。被截获的包裹有时会变成执法人员上门:签收当场记罪证并查封,拒签只损失货款。出售:在黑市的卖货页把储藏区里的违禁品、高科技物品和显卡上架,标价是参考价的 0.6 到 1.8 倍。倍率越高成交越慢(0.9 以下约一天,1.0 约两天,1.8 约十四天),货款带污点的可能性和比例也越高,近 7 天出售的量越大,污点越重;同时最多上架 10 件,上架收 5% 上架费,上架后可以改价(收 2% 改价费,标价按参考价重算,成交的快慢跟着新倍率走),成交扣 8% 抽成,货款托管 3 天后进钱包;卖假卡可能被买家看穿而退货,拉低好评;平台跑路时上架的货和未放款的货款都没了Line truncated
item.web3guide.desc,"银行:存入把信用点换成 Poinbase 账户里的 CRC;提取把 CRC 换回信用点,要过合规审查,审查看 Poinbase 账户的污点。交易:买入按计价币的数量支付,卖出按所交易币的数量卖出。混币器:选币种、填数量和轮数,每轮扣手续费并降低污点,轮数即等待天数,到期提回同一个地址;存入越多,清洗越差。硬件钱包:链上的币放在 PLEDGER 硬件钱包里,每个钱包的余额和污点各算各的;在终端的钱包页打开、连接。Web3 页的交易、黑市、混币器用已连接的钱包,用币付款的顾客和挖矿收益也进它。付款(黑市、混币器、Ponero 兑换处、上架费)先在终端开账单,再在钱包里手输收款地址、按住 ✓ 签名;地址末尾两位是校验位,输错一位多半会被拦下,偶尔碰巧合法,币就转进了没人用的地址。DEX 兑换也要在钱包上签名。Poinbase 是托管账户,可以直接提到已连接的钱包;从钱包充值要转到 Poinbase 的充值地址,只收 CRC 和 PSC。更多硬件钱包向杰克逊博士购买,拖到交易终端上添加,最多 5 个;黑市上也有更便宜的。不要的钱包可以在钱包页销毁,要先把币转走。转账要付手续费,分慢、普通、快三档,gas 价格大约一周一个起落;网络拥堵时手续费变贵,慢档可能被挤出内存池。转账前核对完整地址。质押:把 CRA 质押进革命军质押池每天有日息,利息并入本金;取出要先申请,等四天才到账,等待期间没有利息,也不能提前拿。质押池靠补贴池付息,补贴池见底会降息,有时还会传出大户撤出的消息,那是预兆:一旦崩盘,三天内 CRA 就一文不值,四天的解锁期来不及。平衡代币 SPARK 可以和 CRA 按价格互相铸销(收手续费),价格波动很大,崩盘时会跟着暴跌。质押、铸销都是合约调用,要在钱包上签名。RatDigg 矿机(M1 / M2 / M3)是独立的机器,算力比显卡大得多、耗电更省,要放电池才挖,可以放模块,不占矿架槽位;只在黑市的矿机商那里有,要黑市声望(M1 40、M2 60、M3 80),偶尔有二手的。暴毙后要往修理槽里放电子元件按顺序修好,修好健康少 20。第 50 到 90 天之间会有一次"矿机时代",提前几天上报纸预告,之后大矿场的耗电成本砍半,全网算力涨上去,显卡矿工的收益被摊薄,低档显卡几乎不赚钱,矿机还行。永续合约:Poinbase 的"永续"页,用账户里的 CRC 当保证金,PSC 最高 5 倍、SPARK 最高 3 倍,一个品种只有一个仓位,不能同时多空。成交价比现价差一截(单越大差得越多,和现货池一样),开平仓还收手续费。强平只在夜里按当天均价检查,权益不到名义价值的 10% 就被强平,保证金没了;每晚还有资金费,价格比近 7 天均价高时多头付给空头。强平后亏光保证金还不够的缺口,先由保险基金垫,基金见底(SPARK 崩盘这类大行情会抽干它)后盈利的仓位会被自动减仓、少拿一半盈利,再不够就记成你的欠款:欠款每天涨 2%,账户里的 CRC 每晚先拿去还,没还清不能开仓、不能出金,七天不还就没收店里的物品抵债,抵不够的核销并拉黑永续账户 30 天。黑市:只收币,不收 CRC,价格比正常渠道贵 30%,高科技物品和显卡另有加价;付出去的币带着按比例的污点留在卖家那边,货不带赃物标签;显卡不保证真假,自己鉴定。订单比现货便宜,要等几天,路上可能被截获;商家按类型卖货,价格系数各不相同,一次订 5 件以上 95 折、10 件以上 9 折,大宗商家随机出现,价格最低但要等六天;托管多付 5% 托管费,收货后放款,卖家跑路时退款;提前放款再打九折,卖家若是骗子钱就没了,只有成交 30 单以上的卖家接受;平台自己也可能跑路,也可能被执法接管,或者卖家落网,之后你的订单会被追查、记罪证;论坛上的传闻可以当预兆。被截获的包裹有时会变成执法人员上门:签收当场记罪证并查封,拒签只损失货款。出售:在黑市的卖货页把储藏区里的违禁品、高科技物品和显卡上架,标价是参考价的 0.6 到 1.8 倍。倍率越高成交越慢(0.9 以下约一天,1.0 约两天,1.8 约十四天),货款带污点的可能性和比例也越高,近 7 天出售的量越大,污点越重;同时最多上架 10 件,上架收 5% 上架费,上架后可以改价(收 2% 改价费,标价按参考价重算,成交的快慢跟着新倍率走),成交扣 8% 抽成,货款托管 3 天后进钱包;卖假卡可能被买家看穿而退货,拉低好评;平台跑路时上架的货和未放款的货款都没了Line truncated
courier.odd1,……东西到了。
courier.odd2,"(他的手一直放在口袋里)在这儿签个字。"
courier.sign,签收
@@ -726,3 +726,7 @@ predict.kind.Cra,CRA 预警
predict.kind.Era,矿机时代
nightlog.predict.move,预测盘「{0}」价格 {1} → {2}
nightlog.predict.why,({0})
chart.empty,PSC 日 K:还没有历史,从今天开始记录。
chart.caption,PSC 日 K({0} 天) 高 {1} 低 {2} 收 {3}({4}%)
chart.legend,<size=80%>绿涨红跌 黄线 7 日均线 柱:灰 大户 / 青 你的成交</size>
chart.legend.thr,<size=80%>绿涨红跌 黄线 7 日均线 蓝虚线 阈值</size>
+5 -1
View File
@@ -55,8 +55,11 @@ namespace Decentralized
var d = Session.Data;
int day = StoreStation.GetDayCounter();
d.Market.Open(ActiveEvents(), d.Rng, day);
d.Market.Whale(d.Rng);
d.Candles.Open(Assets.PSC, day, d.Market.Price);
double whale = d.Market.Whale(d.Rng);
d.Candles.Tick(Assets.PSC, day, d.Market.Price, whale);
if (day >= Tuning.ScamMinDay) { double wk = d.Market.TryWick(d.Rng, day); if (wk != 0) Log.Info($"插针 {wk:+0.000;-0.000},当晚回去 {d.Market.WickBack:0.00}"); }
d.Candles.Tick(Assets.PSC, day, d.Market.Price);
PredictGame.Morning(d, day);
if (!d.OpeningNewsShown)
{
@@ -187,6 +190,7 @@ namespace Decentralized
// 预测市场:先登记今晚的观测再结算到期的盘口;行情盘读夜间更新之前的价格
double pscMark = d.Market.Mark;
d.Market.UndoWick(day);
d.Candles.Close(Assets.PSC, day, d.Market.Price);
PredictGame.ClosePrice = d.Market.Price; PredictGame.CloseGas = d.Gas; PredictGame.ClosePush = d.Market.PlayerPush;
// 永续:用今天的标记价(当日均价)结算,要在今晚的价格更新之前
var perpEvents = d.Perps.Night(day, new Dictionary<string, double> { ["PSC"] = pscMark, ["SPARK"] = d.Stable.Spark }, d.Poinbase, Session.Price);
+2
View File
@@ -39,6 +39,8 @@ namespace Decentralized
public Ponzi Ponzi = new Ponzi();
/// <summary>NPC 骗局:空投与授权、第三方收益池、骗子地址。</summary>
public Scams Scams = new Scams();
/// <summary>日 K 历史(PSC,Poinbase 主池价格)。</summary>
public CandleBook Candles = new CandleBook();
/// <summary>今天被伪造转账骗走的(晨间日志用):顾客名 + 信用点。</summary>
public List<string> FakePaidToday = new List<string>();
/// <summary>近几天的 gas 指数(每晚记明天的),情报线索里显示;最近一份局势简报。</summary>
+7 -1
View File
@@ -246,6 +246,8 @@ namespace Decentralized
if (_poinTab == PoinTab.Perp) { PerpPage(b); return; }
Columns(b, l =>
{
CandleChart.Add(l, "poin", d.Candles.Of(Assets.PSC));
l.AddSeparator();
l.AddHeader(L.T("poin.account.h"));
Holdings(l, w, a => true);
if (w.Taint > 0.5) l.AddLabel(L.T("wallet.taint", Fmt.Credits(w.Taint)));
@@ -310,6 +312,8 @@ namespace Decentralized
foreach (var p in PerpBook.Products)
l.AddLabel(L.T("perp.rate", p, Fmt.Num(PerpSpot(p)), (bk.Rate(p) * 100).ToString("+0.00;-0.00;0.00", CultureInfo.InvariantCulture)));
l.AddLabel(L.T("perp.fund", Fmt.Credits(bk.InsuranceFund)));
l.AddSeparator();
CandleChart.Add(l, "perp", d.Candles.Of(Assets.PSC));
}, r =>
{
r.AddHeader(L.T("perp.open"));
@@ -608,6 +612,8 @@ namespace Decentralized
l.AddHeader(L.T("predict.h"));
l.AddLabel(L.T("predict.acct", WalletWindow.NameOf(w), Fmt.Num(w.Avail(Assets.CRC))));
l.AddSeparator();
// 选中 PSC 价格盘时,在列表上方画日 K 和阈值线
if (sel != null && sel.Kind == PredictKind.Price) { CandleChart.Add(l, "predict", d.Candles.Of(Assets.PSC), sel.Param); l.AddSeparator(); }
if (open.Count == 0) l.AddLabel(L.T("predict.none"));
foreach (var m in open)
{
@@ -1707,7 +1713,7 @@ namespace Decentralized
if (w.Avail(pay) + 1e-9 < v) { _message = L.T(frozenPay(w, pay) ? "msg.frozen" : "msg.balance"); Open(); return; }
double before = p.Price;
double got = buy ? p.BuyBase(v) : p.SellBase(v);
if (p == Session.Data.Market.Main) { Session.Data.Market.PlayerPush += Math.Log(p.Price / before); Log.Info($"现货推价:累计 {Session.Data.Market.PlayerPush:0.000}"); }
if (p == Session.Data.Market.Main) { Session.Data.Market.PlayerPush += Math.Log(p.Price / before); Session.Data.Candles.Tick(Assets.PSC, StoreStation.GetDayCounter(), p.Price, v * Session.Price(pay), true); Log.Info($"现货推价:累计 {Session.Data.Market.PlayerPush:0.000}"); }
double spent = v * Session.Price(pay);
w.Add(pay, -v);
w.Add(get, got);
@@ -1408,6 +1408,32 @@ internal static class Program
Check(f2 == 0, "小额内幕卖出安全");
});
Test("日 K:开盘、日内高低、成交量、收盘、均线、保留天数", () =>
{
var cb = new CandleBook();
cb.Open(Assets.PSC, 5, 100);
cb.Tick(Assets.PSC, 5, 120, 3000);
cb.Tick(Assets.PSC, 5, 90, 500, true);
cb.Close(Assets.PSC, 5, 105);
var k = cb.Of(Assets.PSC)[0];
Check(k.O == 100 && k.H == 120 && k.L == 90 && k.C == 105 && k.Closed, "开高低收");
Check(k.VolNpc == 3000 && k.VolPlayer == 500, "成交量分大户和玩家");
cb.Tick(Assets.PSC, 5, 200);
Check(k.H == 120 && k.C == 105, "收盘后不再变");
cb.Tick(Assets.PSC, 6, 110);
Check(cb.Of(Assets.PSC).Count == 2 && cb.Of(Assets.PSC)[1].O == 110, "读档时没有当天的蜡烛就按现价开一根");
var cb2 = new CandleBook();
cb2.Open(Assets.PSC, 5, 100); cb2.Close(Assets.PSC, 5, 105);
cb2.Open(Assets.PSC, 6, 98);
var k6 = cb2.Of(Assets.PSC)[1];
Check(k6.O == 105 && k6.H == 105 && k6.L == 98 && k6.C == 98, "开盘接昨天收盘,夜间变动算进今天这根");
for (int d = 7; d < 7 + CandleBook.Keep + 10; d++) { cb.Open(Assets.PSC, d, d); cb.Close(Assets.PSC, d, d); }
Check(cb.Of(Assets.PSC).Count == CandleBook.Keep, "只保留最近若干天");
var ma = CandleBook.Ma(new List<Candle> { new Candle { C = 1 }, new Candle { C = 3 }, new Candle { C = 5 } }, 2);
Check(ma[0] == 1 && ma[1] == 2 && ma[2] == 4, "均线");
Check(cb.Of("SPARK").Count == 0, "没有的币种是空的");
});
Test("预测市场:先验概率", () =>
{
Check(Math.Abs(PredictMath.PurityAtLeast(8500, 8000, 8999) - 0.5) < 1e-9, "纯度 8500 以上一半");