Python金融数据分析实战:使用Finnhub API构建专业级数据管道

news2026/5/7 11:29:42
Python金融数据分析实战使用Finnhub API构建专业级数据管道【免费下载链接】finnhub-pythonFinnhub Python API Client. Finnhub API provides institutional-grade financial data to investors, fintech startups and investment firms. We support real-time stock price, global fundamentals, global ETFs holdings and alternative data. https://finnhub.io/docs/api项目地址: https://gitcode.com/gh_mirrors/fi/finnhub-python在当今数据驱动的金融市场中获取准确、实时的金融数据是做出明智投资决策的关键。Finnhub Python API客户端为开发者提供了访问机构级金融数据的便捷通道无论是股票价格、财务报告还是市场新闻都能通过简洁的Python接口轻松获取。本文将带你深入探索如何利用Finnhub API构建高效的数据管道从基础配置到高级应用全面提升你的金融数据分析能力。金融数据获取的核心概念解析金融数据获取不仅仅是简单的API调用而是构建完整数据生态系统的起点。Finnhub API将复杂的金融数据抽象为几个核心概念股票代码映射每个上市公司都有唯一的标识符如AAPL代表苹果公司。Finnhub支持多种标识方式包括股票代码、ISIN和CUSIP。时间粒度选择金融数据的时间维度至关重要Finnhub提供分钟、小时、日、周、月等多种时间粒度满足不同分析需求。数据端点分类Finnhub将数据分为市场数据、基本面分析、新闻舆情和技术指标四大类每类都有专门的API端点。API响应格式Finnhub返回标准化的JSON格式包含时间戳、价格、成交量等关键字段便于后续处理和分析。环境搭建与基础配置开始之前首先需要安装Finnhub Python客户端并配置API密钥。Finnhub提供免费套餐足以满足个人项目和小型应用的需求。pip install finnhub-python配置API密钥的最佳实践是使用环境变量避免在代码中硬编码敏感信息import os import finnhub # 从环境变量获取API密钥 api_key os.environ.get(FINNHUB_API_KEY) if not api_key: raise ValueError(请设置FINNHUB_API_KEY环境变量) # 初始化客户端 client finnhub.Client(api_keyapi_key) # 验证连接 try: # 获取苹果公司基本信息 profile client.company_profile(symbolAAPL) print(f连接成功API版本{client.api_key[:8]}...) except Exception as e: print(f连接失败{e})实战演练构建多维度金融数据分析器实时市场监控系统实时监控是量化交易的基础。以下代码展示了如何构建一个简单的市场监控系统import time from datetime import datetime import pandas as pd class MarketMonitor: def __init__(self, client, symbolsNone): self.client client self.symbols symbols or [AAPL, MSFT, GOOGL, AMZN, TSLA] self.price_history {symbol: [] for symbol in self.symbols} def fetch_realtime_quotes(self): 获取实时报价数据 quotes {} for symbol in self.symbols: try: quote self.client.quote(symbol) quotes[symbol] { current_price: quote.get(c, 0), change: quote.get(d, 0), percent_change: quote.get(dp, 0), volume: quote.get(v, 0), timestamp: datetime.now().isoformat() } # 添加到历史记录 self.price_history[symbol].append(quotes[symbol]) # 保持最近100条记录 if len(self.price_history[symbol]) 100: self.price_history[symbol].pop(0) time.sleep(0.5) # 遵守API速率限制 except Exception as e: print(f获取{symbol}数据失败{e}) return quotes def calculate_moving_average(self, symbol, period20): 计算移动平均线 if len(self.price_history[symbol]) period: return None prices [item[current_price] for item in self.price_history[symbol][-period:]] return sum(prices) / len(prices) def generate_market_report(self): 生成市场分析报告 quotes self.fetch_realtime_quotes() report_lines [] for symbol, data in quotes.items(): ma_20 self.calculate_moving_average(symbol, 20) ma_50 self.calculate_moving_average(symbol, 50) report_lines.append(f {symbol} 分析 -------------------- 当前价格${data[current_price]:.2f} 涨跌幅{data[percent_change]:.2f}% 成交量{data[volume]:,} 20日均线${ma_20:.2f if ma_20 else N/A} 50日均线${ma_50:.2f if ma_50 else N/A} ) return \n.join(report_lines) # 使用示例 monitor MarketMonitor(client) print(monitor.generate_market_report())基本面数据分析管道基本面分析是评估公司内在价值的关键。Finnhub提供了丰富的财务数据接口class FundamentalAnalyzer: def __init__(self, client): self.client client def analyze_company(self, symbol): 全面分析公司基本面 analysis {} # 1. 公司基本信息 analysis[profile] self.client.company_profile(symbolsymbol) # 2. 财务数据 analysis[financials] self.client.company_basic_financials(symbol, all) # 3. 盈利预测 analysis[earnings] self.client.company_earnings(symbol, limit4) # 4. 估值指标 analysis[metrics] self._extract_financial_metrics(analysis[financials]) return analysis def _extract_financial_metrics(self, financials): 从财务数据中提取关键指标 metrics financials.get(metric, {}) return { pe_ratio: metrics.get(peNormalizedAnnual), pb_ratio: metrics.get(pbAnnual), dividend_yield: metrics.get(dividendYieldIndicatedAnnual), roe: metrics.get(roeTTM), roa: metrics.get(roaTTM), profit_margin: metrics.get(netProfitMarginTTM) } def generate_fundamental_report(self, symbol): 生成基本面分析报告 data self.analyze_company(symbol) report f {symbol} 基本面分析报告 公司概况 -------- 名称{data[profile].get(name, N/A)} 行业{data[profile].get(finnhubIndustry, N/A)} 市值${data[profile].get(marketCapitalization, 0):,.0f} 财务指标 -------- 市盈率{data[metrics].get(pe_ratio, N/A)} 市净率{data[metrics].get(pb_ratio, N/A)} 股息率{data[metrics].get(dividend_yield, N/A)} 净资产收益率{data[metrics].get(roe, N/A)} 盈利趋势 -------- if data[earnings]: for earning in data[earnings][:3]: # 显示最近3个季度 report f 季度{earning.get(period)} 实际EPS{earning.get(actual, N/A)} 预期EPS{earning.get(estimate, N/A)} 差异{earning.get(surprise, N/A)} return report # 使用示例 analyzer FundamentalAnalyzer(client) report analyzer.generate_fundamental_report(MSFT) print(report)进阶应用构建事件驱动交易策略新闻情绪分析系统市场情绪对股价有显著影响。Finnhub的新闻API可以帮助我们量化这种影响import pandas as pd from datetime import datetime, timedelta class NewsSentimentAnalyzer: def __init__(self, client): self.client client def analyze_news_impact(self, symbol, days_back7): 分析指定时间段内的新闻情绪 end_date datetime.now() start_date end_date - timedelta(daysdays_back) # 获取新闻数据 news self.client.company_news( symbol, _fromstart_date.strftime(%Y-%m-%d), toend_date.strftime(%Y-%m-%d) ) if not news: return {total_news: 0, avg_sentiment: 0} # 分析情绪得分 sentiments [] for item in news: sentiment item.get(sentiment, 0) sentiments.append(sentiment) return { total_news: len(news), avg_sentiment: sum(sentiments) / len(sentiments) if sentiments else 0, positive_news: len([s for s in sentiments if s 0]), negative_news: len([s for s in sentiments if s 0]), neutral_news: len([s for s in sentiments if s 0]) } def correlate_news_with_price(self, symbol, days_back30): 关联新闻情绪与价格变化 # 获取历史价格数据 end_timestamp int(datetime.now().timestamp()) start_timestamp int((datetime.now() - timedelta(daysdays_back)).timestamp()) candles self.client.stock_candles(symbol, D, start_timestamp, end_timestamp) if candles[s] ! ok: return None # 构建时间序列数据 dates [datetime.fromtimestamp(ts) for ts in candles[t]] prices candles[c] # 分析每日新闻情绪 correlation_data [] for date, price in zip(dates, prices): daily_news self.analyze_news_impact( symbol, days_back1, # 分析当天的新闻 custom_startdate.strftime(%Y-%m-%d), custom_enddate.strftime(%Y-%m-%d) ) correlation_data.append({ date: date, price: price, sentiment: daily_news[avg_sentiment], news_count: daily_news[total_news] }) return pd.DataFrame(correlation_data) # 使用示例 sentiment_analyzer NewsSentimentAnalyzer(client) sentiment_data sentiment_analyzer.analyze_news_impact(AAPL, days_back3) print(f苹果公司最近3天新闻情绪分析{sentiment_data})技术指标集成分析技术分析是量化交易的重要组成部分。Finnhub提供了多种技术指标class TechnicalAnalyzer: def __init__(self, client): self.client client def get_technical_indicators(self, symbol, resolutionD, period50): 获取多种技术指标 # 获取聚合指标 aggregate self.client.aggregate_indicator(symbol, resolution) # 获取历史数据计算自定义指标 end_timestamp int(datetime.now().timestamp()) start_timestamp end_timestamp - (period * 24 * 3600) # 转换为秒 candles self.client.stock_candles(symbol, resolution, start_timestamp, end_timestamp) if candles[s] ! ok: return None # 计算简单技术指标 prices candles[c] if len(prices) 2: latest_price prices[-1] prev_price prices[-2] price_change ((latest_price - prev_price) / prev_price) * 100 # 计算RSI简化版本 gains [] losses [] for i in range(1, len(prices)): change prices[i] - prices[i-1] if change 0: gains.append(change) else: losses.append(abs(change)) avg_gain sum(gains) / len(gains) if gains else 0 avg_loss sum(losses) / len(losses) if losses else 1 rsi 100 - (100 / (1 (avg_gain / avg_loss))) else: price_change 0 rsi 50 return { aggregate_signal: aggregate.get(technicalAnalysis, {}).get(signal, neutral), trend: aggregate.get(trend, {}).get(adx, 0), rsi: rsi, price_change_percent: price_change, support_levels: aggregate.get(technicalAnalysis, {}).get(support, []), resistance_levels: aggregate.get(technicalAnalysis, {}).get(resistance, []) } def generate_trading_signals(self, symbol): 生成交易信号 indicators self.get_technical_indicators(symbol) signals [] # RSI信号 if indicators[rsi] 70: signals.append(RSI超买考虑卖出) elif indicators[rsi] 30: signals.append(RSI超卖考虑买入) # 聚合信号 if indicators[aggregate_signal] buy: signals.append(技术分析显示买入信号) elif indicators[aggregate_signal] sell: signals.append(技术分析显示卖出信号) # 趋势信号 if indicators[trend] 25: signals.append(趋势明显适合趋势跟踪策略) return { symbol: symbol, signals: signals, indicators: indicators } # 使用示例 technical_analyzer TechnicalAnalyzer(client) trading_signals technical_analyzer.generate_trading_signals(NVDA) print(f英伟达交易信号{trading_signals})最佳实践与性能优化异步数据获取对于需要获取多个股票数据的场景使用异步请求可以显著提高效率import asyncio import aiohttp import time class AsyncFinnhubClient: def __init__(self, api_key, max_concurrent5): self.api_key api_key self.base_url https://finnhub.io/api/v1 self.max_concurrent max_concurrent self.session None async def __aenter__(self): self.session aiohttp.ClientSession() return self async def __aexit__(self, exc_type, exc_val, exc_tb): await self.session.close() async def fetch_quote(self, symbol): 异步获取股票报价 url f{self.base_url}/quote params { symbol: symbol, token: self.api_key } async with self.session.get(url, paramsparams) as response: if response.status 200: return await response.json() else: print(f获取{symbol}数据失败{response.status}) return None async def fetch_multiple_quotes(self, symbols): 批量获取多个股票报价 tasks [] for symbol in symbols: tasks.append(self.fetch_quote(symbol)) # 控制并发数量 if len(tasks) self.max_concurrent: results await asyncio.gather(*tasks) tasks [] yield from results if tasks: results await asyncio.gather(*tasks) yield from results # 使用示例 async def main(): symbols [AAPL, MSFT, GOOGL, AMZN, TSLA, NVDA, META, NFLX] async with AsyncFinnhubClient(api_keyapi_key) as client: start_time time.time() quotes [] async for quote in client.fetch_multiple_quotes(symbols): if quote: quotes.append(quote) elapsed time.time() - start_time print(f获取{len(quotes)}个股票数据耗时{elapsed:.2f}秒) # 运行异步函数 # asyncio.run(main())数据缓存策略为了减少API调用次数并提高响应速度实现智能缓存机制import json import hashlib import os from datetime import datetime, timedelta class SmartCache: def __init__(self, cache_dir.finnhub_cache, ttl_hours24): self.cache_dir cache_dir self.ttl timedelta(hoursttl_hours) if not os.path.exists(cache_dir): os.makedirs(cache_dir) def _get_cache_key(self, endpoint, params): 生成缓存键 param_str json.dumps(params, sort_keysTrue) key_str f{endpoint}_{param_str} return hashlib.md5(key_str.encode()).hexdigest() def _get_cache_path(self, key): 获取缓存文件路径 return os.path.join(self.cache_dir, f{key}.json) def get(self, endpoint, params): 从缓存获取数据 key self._get_cache_key(endpoint, params) cache_path self._get_cache_path(key) if not os.path.exists(cache_path): return None # 检查缓存是否过期 file_time datetime.fromtimestamp(os.path.getmtime(cache_path)) if datetime.now() - file_time self.ttl: os.remove(cache_path) return None try: with open(cache_path, r) as f: return json.load(f) except: return None def set(self, endpoint, params, data): 设置缓存数据 key self._get_cache_key(endpoint, params) cache_path self._get_cache_path(key) with open(cache_path, w) as f: json.dump(data, f) def clear_expired(self): 清理过期缓存 now datetime.now() for filename in os.listdir(self.cache_dir): filepath os.path.join(self.cache_dir, filename) if os.path.isfile(filepath): file_time datetime.fromtimestamp(os.path.getmtime(filepath)) if now - file_time self.ttl: os.remove(filepath) # 使用缓存的客户端包装器 class CachedFinnhubClient: def __init__(self, client, cacheNone): self.client client self.cache cache or SmartCache() def quote(self, symbol): 带缓存的报价获取 endpoint quote params {symbol: symbol} # 尝试从缓存获取 cached_data self.cache.get(endpoint, params) if cached_data: print(f从缓存获取{symbol}数据) return cached_data # 从API获取 data self.client.quote(symbol) # 保存到缓存 self.cache.set(endpoint, params, data) return data def company_profile(self, **params): 带缓存的公司信息获取 endpoint company_profile cached_data self.cache.get(endpoint, params) if cached_data: symbol params.get(symbol, unknown) print(f从缓存获取{symbol}公司信息) return cached_data data self.client.company_profile(**params) self.cache.set(endpoint, params, data) return data # 使用示例 cache SmartCache(ttl_hours6) # 6小时缓存 cached_client CachedFinnhubClient(client, cache) # 第一次调用会从API获取 profile1 cached_client.company_profile(symbolAAPL) # 第二次调用会从缓存获取 profile2 cached_client.company_profile(symbolAAPL)错误处理与重试机制构建健壮的错误处理系统import time from functools import wraps from finnhub.exceptions import FinnhubAPIException def retry_on_failure(max_retries3, delay1, backoff_factor2): 重试装饰器 def decorator(func): wraps(func) def wrapper(*args, **kwargs): last_exception None for attempt in range(max_retries): try: return func(*args, **kwargs) except FinnhubAPIException as e: last_exception e if e.status_code 429: # 速率限制 wait_time delay * (backoff_factor ** attempt) print(f速率限制等待{wait_time}秒后重试...) time.sleep(wait_time) elif e.status_code 500: # 服务器错误 wait_time delay * (backoff_factor ** attempt) print(f服务器错误等待{wait_time}秒后重试...) time.sleep(wait_time) else: raise # 其他错误直接抛出 except Exception as e: last_exception e wait_time delay * (backoff_factor ** attempt) print(f请求失败{wait_time}秒后重试...) time.sleep(wait_time) raise last_exception return wrapper return decorator class RobustFinnhubClient: def __init__(self, client): self.client client retry_on_failure(max_retries3, delay2) def safe_quote(self, symbol): 安全的报价获取 return self.client.quote(symbol) retry_on_failure(max_retries2, delay1) def safe_company_profile(self, **params): 安全的公司信息获取 return self.client.company_profile(**params) def batch_safe_requests(self, requests_list): 批量安全请求 results [] for request in requests_list: try: if request[type] quote: result self.safe_quote(request[symbol]) elif request[type] profile: result self.safe_company_profile(**request[params]) else: result None results.append({ success: True, data: result, request: request }) except Exception as e: results.append({ success: False, error: str(e), request: request }) # 避免触发速率限制 time.sleep(0.5) return results # 使用示例 robust_client RobustFinnhubClient(client) # 批量请求 requests [ {type: quote, symbol: AAPL}, {type: quote, symbol: MSFT}, {type: profile, params: {symbol: GOOGL}}, {type: profile, params: {symbol: AMZN}} ] results robust_client.batch_safe_requests(requests) for result in results: if result[success]: print(f{result[request]} 成功) else: print(f{result[request]} 失败{result[error]})项目结构与代码组织建议基于Finnhub API的项目应该遵循良好的代码组织结构finnhub_project/ ├── config/ │ ├── __init__.py │ └── settings.py # 配置文件 ├── data/ │ ├── cache/ # 缓存数据 │ ├── raw/ # 原始数据 │ └── processed/ # 处理后的数据 ├── src/ │ ├── clients/ │ │ ├── __init__.py │ │ ├── base_client.py # 基础客户端 │ │ ├── cached_client.py # 缓存客户端 │ │ └── async_client.py # 异步客户端 │ ├── analyzers/ │ │ ├── __init__.py │ │ ├── technical.py # 技术分析 │ │ ├── fundamental.py # 基本面分析 │ │ └── sentiment.py # 情绪分析 │ ├── models/ │ │ ├── __init__.py │ │ └── data_models.py # 数据模型 │ └── utils/ │ ├── __init__.py │ ├── cache.py # 缓存工具 │ └── validators.py # 数据验证 ├── tests/ │ ├── __init__.py │ ├── test_clients.py │ └── test_analyzers.py ├── scripts/ │ ├── fetch_data.py # 数据获取脚本 │ └── analyze_portfolio.py # 投资组合分析 ├── requirements.txt ├── .env.example └── README.md性能监控与优化技巧API使用统计监控API使用情况避免超出限制class APIMonitor: def __init__(self): self.requests_count 0 self.start_time time.time() self.request_log [] def log_request(self, endpoint, paramsNone): 记录API请求 self.requests_count 1 self.request_log.append({ timestamp: time.time(), endpoint: endpoint, params: params }) # 清理旧的记录保留最近1000条 if len(self.request_log) 1000: self.request_log self.request_log[-1000:] def get_usage_stats(self): 获取使用统计 elapsed_hours (time.time() - self.start_time) / 3600 requests_per_hour self.requests_count / elapsed_hours if elapsed_hours 0 else 0 return { total_requests: self.requests_count, elapsed_hours: elapsed_hours, requests_per_hour: requests_per_hour, recent_requests: self.request_log[-10:] if self.request_log else [] } def check_rate_limit(self, max_per_hour60): 检查是否接近速率限制 stats self.get_usage_stats() return stats[requests_per_hour] max_per_hour * 0.8 # 80%阈值 # 集成监控的客户端 class MonitoredFinnhubClient: def __init__(self, client, monitorNone): self.client client self.monitor monitor or APIMonitor() def quote(self, symbol): self.monitor.log_request(quote, {symbol: symbol}) # 检查速率限制 if not self.monitor.check_rate_limit(): print(警告接近API速率限制) time.sleep(1) # 主动延迟 return self.client.quote(symbol) def get_usage_report(self): return self.monitor.get_usage_stats() # 使用示例 monitor APIMonitor() monitored_client MonitoredFinnhubClient(client, monitor) # 正常使用 for symbol in [AAPL, MSFT, GOOGL]: quote monitored_client.quote(symbol) print(f{symbol}: ${quote.get(c, 0):.2f}) # 查看使用统计 stats monitored_client.get_usage_report() print(f总请求数{stats[total_requests]}) print(f每小时请求数{stats[requests_per_hour]:.2f})总结与下一步行动Finnhub Python API为金融数据分析提供了强大而灵活的工具集。通过本文的实战示例你已经掌握了基础配置如何正确设置API客户端和密钥管理核心功能实时报价、基本面分析、技术指标获取高级应用新闻情绪分析、事件驱动策略、异步处理最佳实践错误处理、缓存策略、性能监控下一步学习路径深入研究官方文档查看 finnhub/init.py 和 finnhub/client.py 了解所有可用方法探索示例代码参考 examples.py 中的完整使用案例构建完整应用结合Pandas进行数据分析使用Matplotlib或Plotly进行可视化集成到现有系统将Finnhub API集成到你的交易系统或数据分析平台中关注更新定期查看 CHANGELOG.md 了解API的新功能和变更关键要点数据质量优先始终验证API返回的数据完整性和准确性遵守速率限制合理设计请求频率避免被限制访问错误处理完善网络请求可能失败确保有适当的重试和降级机制缓存策略智能根据数据更新频率设计合理的缓存策略监控与分析持续监控API使用情况优化请求模式通过合理利用Finnhub Python API你可以构建出专业级的金融数据分析系统无论是个人投资分析、量化交易策略开发还是企业级金融应用都能获得强大的数据支持。开始你的金融数据探索之旅吧【免费下载链接】finnhub-pythonFinnhub Python API Client. Finnhub API provides institutional-grade financial data to investors, fintech startups and investment firms. We support real-time stock price, global fundamentals, global ETFs holdings and alternative data. https://finnhub.io/docs/api项目地址: https://gitcode.com/gh_mirrors/fi/finnhub-python创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2591321.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

SpringBoot-17-MyBatis动态SQL标签之常用标签

文章目录 1 代码1.1 实体User.java1.2 接口UserMapper.java1.3 映射UserMapper.xml1.3.1 标签if1.3.2 标签if和where1.3.3 标签choose和when和otherwise1.4 UserController.java2 常用动态SQL标签2.1 标签set2.1.1 UserMapper.java2.1.2 UserMapper.xml2.1.3 UserController.ja…

wordpress后台更新后 前端没变化的解决方法

使用siteground主机的wordpress网站,会出现更新了网站内容和修改了php模板文件、js文件、css文件、图片文件后,网站没有变化的情况。 不熟悉siteground主机的新手,遇到这个问题,就很抓狂,明明是哪都没操作错误&#x…

网络编程(Modbus进阶)

思维导图 Modbus RTU(先学一点理论) 概念 Modbus RTU 是工业自动化领域 最广泛应用的串行通信协议,由 Modicon 公司(现施耐德电气)于 1979 年推出。它以 高效率、强健性、易实现的特点成为工业控制系统的通信标准。 包…

UE5 学习系列(二)用户操作界面及介绍

这篇博客是 UE5 学习系列博客的第二篇,在第一篇的基础上展开这篇内容。博客参考的 B 站视频资料和第一篇的链接如下: 【Note】:如果你已经完成安装等操作,可以只执行第一篇博客中 2. 新建一个空白游戏项目 章节操作,重…

IDEA运行Tomcat出现乱码问题解决汇总

最近正值期末周,有很多同学在写期末Java web作业时,运行tomcat出现乱码问题,经过多次解决与研究,我做了如下整理: 原因: IDEA本身编码与tomcat的编码与Windows编码不同导致,Windows 系统控制台…

利用最小二乘法找圆心和半径

#include <iostream> #include <vector> #include <cmath> #include <Eigen/Dense> // 需安装Eigen库用于矩阵运算 // 定义点结构 struct Point { double x, y; Point(double x_, double y_) : x(x_), y(y_) {} }; // 最小二乘法求圆心和半径 …

使用docker在3台服务器上搭建基于redis 6.x的一主两从三台均是哨兵模式

一、环境及版本说明 如果服务器已经安装了docker,则忽略此步骤,如果没有安装,则可以按照一下方式安装: 1. 在线安装(有互联网环境): 请看我这篇文章 传送阵>> 点我查看 2. 离线安装(内网环境):请看我这篇文章 传送阵>> 点我查看 说明&#xff1a;假设每台服务器已…

XML Group端口详解

在XML数据映射过程中&#xff0c;经常需要对数据进行分组聚合操作。例如&#xff0c;当处理包含多个物料明细的XML文件时&#xff0c;可能需要将相同物料号的明细归为一组&#xff0c;或对相同物料号的数量进行求和计算。传统实现方式通常需要编写脚本代码&#xff0c;增加了开…

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器的上位机配置操作说明

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器专为工业环境精心打造&#xff0c;完美适配AGV和无人叉车。同时&#xff0c;集成以太网与语音合成技术&#xff0c;为各类高级系统&#xff08;如MES、调度系统、库位管理、立库等&#xff09;提供高效便捷的语音交互体验。 L…

(LeetCode 每日一题) 3442. 奇偶频次间的最大差值 I (哈希、字符串)

题目&#xff1a;3442. 奇偶频次间的最大差值 I 思路 &#xff1a;哈希&#xff0c;时间复杂度0(n)。 用哈希表来记录每个字符串中字符的分布情况&#xff0c;哈希表这里用数组即可实现。 C版本&#xff1a; class Solution { public:int maxDifference(string s) {int a[26]…

【大模型RAG】拍照搜题技术架构速览:三层管道、两级检索、兜底大模型

摘要 拍照搜题系统采用“三层管道&#xff08;多模态 OCR → 语义检索 → 答案渲染&#xff09;、两级检索&#xff08;倒排 BM25 向量 HNSW&#xff09;并以大语言模型兜底”的整体框架&#xff1a; 多模态 OCR 层 将题目图片经过超分、去噪、倾斜校正后&#xff0c;分别用…

【Axure高保真原型】引导弹窗

今天和大家中分享引导弹窗的原型模板&#xff0c;载入页面后&#xff0c;会显示引导弹窗&#xff0c;适用于引导用户使用页面&#xff0c;点击完成后&#xff0c;会显示下一个引导弹窗&#xff0c;直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…

接口测试中缓存处理策略

在接口测试中&#xff0c;缓存处理策略是一个关键环节&#xff0c;直接影响测试结果的准确性和可靠性。合理的缓存处理策略能够确保测试环境的一致性&#xff0c;避免因缓存数据导致的测试偏差。以下是接口测试中常见的缓存处理策略及其详细说明&#xff1a; 一、缓存处理的核…

龙虎榜——20250610

上证指数放量收阴线&#xff0c;个股多数下跌&#xff0c;盘中受消息影响大幅波动。 深证指数放量收阴线形成顶分型&#xff0c;指数短线有调整的需求&#xff0c;大概需要一两天。 2025年6月10日龙虎榜行业方向分析 1. 金融科技 代表标的&#xff1a;御银股份、雄帝科技 驱动…

观成科技:隐蔽隧道工具Ligolo-ng加密流量分析

1.工具介绍 Ligolo-ng是一款由go编写的高效隧道工具&#xff0c;该工具基于TUN接口实现其功能&#xff0c;利用反向TCP/TLS连接建立一条隐蔽的通信信道&#xff0c;支持使用Let’s Encrypt自动生成证书。Ligolo-ng的通信隐蔽性体现在其支持多种连接方式&#xff0c;适应复杂网…

铭豹扩展坞 USB转网口 突然无法识别解决方法

当 USB 转网口扩展坞在一台笔记本上无法识别,但在其他电脑上正常工作时,问题通常出在笔记本自身或其与扩展坞的兼容性上。以下是系统化的定位思路和排查步骤,帮助你快速找到故障原因: 背景: 一个M-pard(铭豹)扩展坞的网卡突然无法识别了,扩展出来的三个USB接口正常。…

未来机器人的大脑:如何用神经网络模拟器实现更智能的决策?

编辑&#xff1a;陈萍萍的公主一点人工一点智能 未来机器人的大脑&#xff1a;如何用神经网络模拟器实现更智能的决策&#xff1f;RWM通过双自回归机制有效解决了复合误差、部分可观测性和随机动力学等关键挑战&#xff0c;在不依赖领域特定归纳偏见的条件下实现了卓越的预测准…

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …

华为云AI开发平台ModelArts

华为云ModelArts&#xff1a;重塑AI开发流程的“智能引擎”与“创新加速器”&#xff01; 在人工智能浪潮席卷全球的2025年&#xff0c;企业拥抱AI的意愿空前高涨&#xff0c;但技术门槛高、流程复杂、资源投入巨大的现实&#xff0c;却让许多创新构想止步于实验室。数据科学家…

深度学习在微纳光子学中的应用

深度学习在微纳光子学中的主要应用方向 深度学习与微纳光子学的结合主要集中在以下几个方向&#xff1a; 逆向设计 通过神经网络快速预测微纳结构的光学响应&#xff0c;替代传统耗时的数值模拟方法。例如设计超表面、光子晶体等结构。 特征提取与优化 从复杂的光学数据中自…